简体   繁体   English

如何使用 pdf2htmlEX 和 Python 将 PDF 转换为 HTML?

[英]How to convert PDF to HTML using pdf2htmlEX and Python?

How to convert PDF to HTML using pdf2htmlEX and Python?如何使用pdf2htmlEX和 Python 将 PDF 转换为 HTML?

Just use the subprocess module只需使用子流程模块

import subprocess
subprocess.call("pdf2htmlEX /path/to/foobar.pdf", shell=True)

It calls the executable pdf2htmlEX .它调用可执行文件pdf2htmlEX It must be somwhere in your $PATH , or you can put the absolute path in the call它必须在您的$PATH某处,或者您可以将绝对路径放在call

If you want to give path of file separately instead of giving it in.call function you can do this:如果你想单独给出文件路径而不是给它 in.call 函数,你可以这样做:

  import subprocess
 >> path = "/home/temp/abc.pdf"
 >> subprocess.call(["pdf2htmlEX" ,path], shell=False)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM