php 将 PDF 转换为 HTML
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/956508/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Convert PDF to HTML
提问by ToughPal
What is the best solution to convert PDF documents to be viewed in the browser as HTML? The site has several PDF documents and the visitor can click on view as HTML and this should be viewed on the screen as an HTML file.
将要在浏览器中查看的 PDF 文档转换为 HTML 的最佳解决方案是什么?该站点有几个 PDF 文档,访问者可以单击以 HTML 格式查看,这应该在屏幕上以 HTML 文件的形式查看。
Standard website running PHP, Linux, Apache.
运行 PHP、Linux、Apache 的标准网站。
采纳答案by Alexis Perrier
pdftohtml works fine : fast, stable but the html result is ugly at best. I have used it for quite some time for a web site that has many job resumes.
pdftohtml 工作正常:快速、稳定,但 html 结果充其量是丑陋的。我在一个有很多工作简历的网站上使用它已经有一段时间了。
It is a good solution for extracting textual content however.
然而,这是提取文本内容的一个很好的解决方案。
I would give the scribd APIa try
我会尝试使用scribd API
or the google apps document API. GOogle does a great job a displaying and converting pdf files
或谷歌应用程序文档 API。GOogle 在显示和转换 pdf 文件方面做得很好
回答by Ian Jacobs
Have you considered keeping the PDF data in a database and then either dynamically creating the PDF or the html page depending on what the visitors select?
您是否考虑过将 PDF 数据保存在数据库中,然后根据访问者的选择动态创建 PDF 或 html 页面?
回答by Kevin K
If you have command line access at your hosting provider, there is a utility called pdftohtml inside of the poppler_utils package.
如果您在托管服务提供商处具有命令行访问权限,则 poppler_utils 包中有一个名为 pdftohtml 的实用程序。
http://poppler.freedesktop.org/
http://poppler.freedesktop.org/
Looks quite easy to use, have not called it from inside of PHP, but it should work.
看起来很容易使用,还没有从 PHP 内部调用它,但它应该可以工作。
回答by mark stephens
If you are prepared to call Java from PHP you could have a look at http://www.jpedal.org/html_index.php
如果您准备从 PHP 调用 Java,您可以查看http://www.jpedal.org/html_index.php

