如何从PDF文档中提取文本? [英] How to extract text from the PDF document?

查看:101
本文介绍了如何从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 @ @ 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(); 


  • class.pdf2text.php 项目首页


    • class.pdf2text.php Project Home

      pdf2textclass不适用于我测试过的所有PDF,如果不适用于您,请尝试 PDF解析器

      pdf2textclass doesn't work with all the PDF's I've tested, If it doesn't work for you, try PDF Parser

      这篇关于如何从PDF文档中提取文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆