You could use something like pdftotext which comes with the Xpdf package on linux. The popen command can then be used to pipe the output of pdftotext into a string:
This is a public domain PDF text extractor entirely written in pure PHP, meaning that you do not need to rely on external commands. It provides a simple interface to retrieve text :
include ( 'PdfToText.phpclass' ) ;
$pdf = new PdfToText ( 'mysample.pdf' ) ;
echo "PDF contents are : " . $pdf -> Text . "\n" ;
发布评论
评论(3)
您可以使用 pdftotext 之类的工具,它是 Linux 上 Xpdf 软件包附带的。然后可以使用 popen 命令将 pdftotext 的输出通过管道传输到字符串中:
You could use something like pdftotext which comes with the Xpdf package on linux. The popen command can then be used to pipe the output of pdftotext into a string:
在您的服务器上安装 APACHE-TIKA。
APACHE-TIKA 支持的文件不只是 pdf 文件。
安装指南:
http://www.acquia.com/blog/use-apache-solr -search-files
最终代码很简单:
Install APACHE-TIKA on your server.
APACHE-TIKA support more then pdf files.
Install guide:
http://www.acquia.com/blog/use-apache-solr-search-files
and final code is easy:
您可以使用此处提供的 PHP 类:
http://www.pdftotext.eu
这是公共域PDF文本提取器完全用纯PHP编写,这意味着您不需要依赖外部命令。它提供了一个简单的界面来检索文本:
You can use the PHP class that is available here :
http://www.pdftotext.eu
This is a public domain PDF text extractor entirely written in pure PHP, meaning that you do not need to rely on external commands. It provides a simple interface to retrieve text :