我有一些包含一些文字和一些图片的PDF。我想将此文档的第一页转换为图像文件,最好是jpg或png,但tiff也可以。我尝试过使用Wand,但是我收到了这个错误:
wand.exceptions.BlobError: unable to open image `myfile.pdf'(changing myfile.py to the actual name): No such file or directory @ error/blob.c/OpenBlob/2735
Exception ignored in: <bound method Image.__del__ of <wand.image.Image: (empty)>>
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/wand/resource.py", line 232, in __del__
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/wand/image.py", line 2767, in destroy
TypeError: object of type 'NoneType' has no len()
我也试过使用ghostscript和pdf2img,也没有运气。
在Python3中将.pdf转换为.jpg或.png的最佳方法是什么?