我正在使用 invoice2data 编写一个程序,该程序需要我使用 Xpdf。我在 Windows 平台上编码。虽然我已经安装了,但我收到错误消息,因为未安装 pdftotext。有人可以帮我解决为什么它不起作用吗?我还更改了环境变量中的路径。还是不行。
下面是我的代码
def to_text(path):
"""
Wrapper around Poppler pdftotext.
"""
if spawn.find_executable("pdftotext"): #shutil.which('pdftotext'):
out, err = subprocess.Popen(
["pdftotext", '-layout', '-enc', 'UTF-8', path, '-'],
stdout=subprocess.PIPE).communicate()
return out
else:
raise EnvironmentError('pdftotext not installed. Can be downloaded from
https://poppler.freedesktop.org/')