Reading PDF files in PHP

Possible duplicate:
Read pdf files with php

Can you read PDF files using PHP code?

+1
php pdf
source share
3 answers

Yes, you can. Or install a command line script that can convert PDF files to text and execute it 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 .

+2
source share

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

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

All Articles