PHP pdf 2文本问题 [英] PHP pdf 2 text problem
本文介绍了PHP pdf 2文本问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Zend_Pdf库从pdf提取文本,但是我遇到了一些问题...
I'm using Zend_Pdf library for extract text from pdf and I have some problems...
<?php
set_include_path (__DIR__ . '\data');
require_once 'Zend/Pdf.php';
// Load PDF document from a file.
$fileName = 'carbsarticle.pdf';
$pdf = new Zend_Pdf($fileName);
$pdf = Zend_Pdf::parse($pdf);
var_dump($pdf);
致命错误:消息为文件不是PDF"的未捕获异常"Zend_Pdf_Exception".
Fatal error: Uncaught exception 'Zend_Pdf_Exception' with message 'File is not a PDF.'
我尝试下载其他pdf文件,但是错误是相同的..
I tried to download other pdf file, but the error is the same ..
try {
$pdf2 = Zend_Pdf::load('test.pdf');
} catch (Exception $e)
{
echo $e->getMessage();
}
这呼应:不支持加密文档修改
This echoes: Encrypted document modification is not supported
我的pdf: http://x3k.ru/test.pdf
推荐答案
好吧,刚刚在zend文档中看到了用法
Okay just saw the usage at zend documentation
#
// Load a PDF document from a file
#
$pdf2 = Zend_Pdf::load($fileName);
#
#
// Load a PDF document from a string
#
$pdf3 = Zend_Pdf::parse($pdfString);
#
...
这是您加载PDF文件的方式.
This is how you load a PDF file.
这篇关于PHP pdf 2文本问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文