Skip to content

Instantly share code, notes, and snippets.

@splanquart
Created November 11, 2011 14:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save splanquart/1358169 to your computer and use it in GitHub Desktop.
Save splanquart/1358169 to your computer and use it in GitHub Desktop.
Kivy : create image from pdf page
import PythonMagick
from pyPdf import PdfFileWriter,PdfFileReader
input1 = PdfFileReader(file('/home/steph/menu.pdf', 'rb'))
p2=input1.getPage(1)
writer=PdfFileWriter()
writer.addPage(p2)
import io
f=io.BytesIO()
writer.write(f)
blob=pm.Blob(f.read())
img=pm.Image(blob)
img.display()
@splanquart
Copy link
Author

requirement Ubuntu :
sudo apt-get install python-pythonmagick python-pypdf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment