如何在Python 3中将PDF的第一页转换为JPG或PNG?

时间:2018-02-18 20:54:19

标签: python python-3.x wand

我有一些包含一些文字和一些图片的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的最佳方法是什么?

0 个答案:

没有答案
相关问题