I am looking for ways to generate jpeg thumbnail of pdf files. I would like to do that in Python. Is there any library or can anyone guide me how to do it?
Thanks
I am working on MacOS X Lion. But I would like to run it on Ubuntu or CentOS.
I am looking for ways to generate jpeg thumbnail of pdf files. I would like to do that in Python. Is there any library or can anyone guide me how to do it?
Thanks
I am working on MacOS X Lion. But I would like to run it on Ubuntu or CentOS.
You can use ImageMagick {apt-get install imagemagick on Ubuntu} (it also has Python lib PythonMagick) to convert pdf to images
import subprocess
params = ['convert', 'pdf_file', 'thumb.jpg']
subprocess.check_call(params)
You can also provide parameters at which the image has to generate out of the pdf like
params = ['convert', '-density 300 -resize 220x205', 'pdf_file', 'thumb.jpg']
subprocess.check_call(params)
If you just need to do it grammatically, why not use an external CLI tool like this:
os.system(r"ConvertPDFtoImage.EXE /S "C:\Input\Coffee.pdf" /T "C:\Output\Coffee.JPG" /C1 /1 * /5 200 /V")
for example in windows