I am trying to convert a PDF to JPG, main goal is to have a thumbnail so that the user can preview the PDF within the application.
Apparently ImageMagick is a good way to do this, yet so far I failed to get it to convert the file.
import subprocess
params = ['convert', '-density 300 -resize 220x205', 'dummy.pdf', 'thumb.jpg']
subprocess.check_call(params)
So this is what I am getting instead of having the file converted:
Unzulässiger Parameter - 300 Traceback (most recent call last): File "pdf_preview_test.py", line 4, in subprocess.check_call(params) File "C:\Users\EliasMessner\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 347, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['convert', '-density 300 -resize 220x205', 'dummy.pdf', 'thumb.jpg']' returned non-zero exit status 4.
I couldn't find any info about the problem. It looks like the "300" parameter is illegal but IMHO it is used correctly.. Help would be much appreciated. Thanks.