在PHP中阅读PDF文件[重复]

Possible Duplicate:
Read pdf files with php

Can you read PDF files by using PHP code?

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.

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