无法读取Pypandoc中的文件



我正在尝试使用Pandoc将pdf转换为html。我已经安装了pandoc二进制文件,添加了环境变量路径,然后使用

import pypandoc
import os
os.environ.setdefault('PYPANDOC_PANDOC', 'C://Program Files//Pandoc//pandoc.exe')

file_path = r"D:/46580375_1593783098922.pdf"
output = pypandoc.convert_file("46580375_1593783098922.pdf", to='html', outputfile= 'test.html')

它给了我一个错误:

RuntimeError: Invalid input format! Got "pdf" but expected one of
these: commonmark, creole, csv, docbook, docx, dokuwiki, epub, fb2,
gfm, haddock, html, ipynb, jats, jira, json, latex, man, markdown,
markdown_github, markdown_mmd, markdown_phpextra, markdown_strict,
mediawiki, muse, native, odt, opml, org, rst, t2t, textile, tikiwiki,
twiki, vimwiki

我错过了什么?

正如错误所说,您无法通过pandoc将PDF转换为HTML。

最新更新