Possible Duplicate:
Read pdf files with php
Hi,
I have a bulk of pdf documents. I want to rea开发者_开发知识库d that using php script. I searched a lot, but everyone is about creating pdf files. Here I dont want to create pdf file but I want to read it. Is there any way to read it php?
-Arun
To just get the text from a PDF file, try these:
- http://davidwalsh.name/read-pdf-doc-file-php
- http://www.webcheatsheet.com/php/reading_clean_text_from_pdf.php (more in-depth)
For a more heavyweight solutions, have a look at:
- http://www.setasign.de/products/pdf-php-solutions/fpdi/
You can easily read the contents of a PDF file using a command-line utility like Pdftotext which you can call through exec.
This is an example of what i mean, actually using system
system("pdftotext your.pdf /tmp/txtfile.txt");
$text = file_get_contents("/tmp/txtfile.txt");
EDIT
didn't know about the dash syntax - this is even better:
$content = shell_exec('pdftotext your.pdf -');
This does require pdftotext to be installed on your server though. On a CentOS server this would be:
yum install xpdf
精彩评论