本文介绍了如何从PDF文档中提取文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用PHP 从PDF文档中提取文本?
How to extract text from the PDF document using PHP?
(我不能使用其他工具,我没有root访问权限)
(I can't use other tools, I don't have root access)
我发现一些函数可用于纯文本,但是它们不能很好地处理Unicode字符:
I've found some functions working for plain text, but they don't handle well Unicode characters:
http://www.hashbangcode.com/blog/zend-lucene-and-pdf-documents-part-2-pdf-data-extraction-437.html
推荐答案
下载 class.pdf2text.php @ @ https://pastebin.com/dvwySU1a 或 http: //www.phpclasses.org/browse/file/31030.html (需要注册)
Download the class.pdf2text.php @ https://pastebin.com/dvwySU1a or http://www.phpclasses.org/browse/file/31030.html (Registration required)
代码:
include('class.pdf2text.php');
$a = new PDF2Text();
$a->setFilename('filename.pdf');
$a->decodePDF();
echo $a->output();