开发者

Reading PDF files in PHP [duplicate]

开发者 https://www.devze.com 2023-02-14 09:09 出处:网络
This question already has answers here: 开发者_运维知识库 Closed 11 years ago. Possible Duplicate:
This question already has answers here: 开发者_运维知识库 Closed 11 years ago.

Possible Duplicate:

Read pdf files with php

Can you read PDF files by using PHP code?


To read PDF files, you will need to install the XPDF ( http://www.foolabs.com/xpdf/about.html ) package, which includes "pdftotext." Once you have XPDF/pdftotext installed, you run the following PHP statement to get the PDF text:

$content = shell_exec('/usr/local/bin/pdftotext '.$filename.' -'); //dash at the end to output content


Yes, you can. Either install a command line script that can convert PDFs to text and execute this in PHP

$content = shell_exec('/usr/local/bin/pdftotext '.$filename.' -'); //dash at the end to output content

(source)

... or write a PHP function like this.


You would have to use a extension like

http://www.pdflib.com/products/pdflib-family/

or

http://framework.zend.com/manual/en/zend.pdf.html

0

精彩评论

暂无评论...
验证码 换一张
取 消