p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   PHP How-To (http://p2p.wrox.com/forumdisplay.php?f=98)
-   -   Count the number of words in a PDF document. (http://p2p.wrox.com/showthread.php?t=5042)

basil123 October 16th, 2003 06:51 AM

Count the number of words in a PDF document.

I have to develop an intranet application that reads documents and count the number of words in that document.I have done the same for text/html/word documents by reading the document using the fopen() function. I have to develop the site in PHP.

BUT i don't know how to do the same for PDF documents. From the php manual I got the information that by installing pdf libraries in the server, we could use functions related to pdf documents.I have downloaded the pdf libraries and installed in my web server.Following are the method that I have tried:

Since the function "pdf_open_pdi" is used to open an existing PDF document,I tried in that way with the following code:

$pdf = pdf_new();
$pdi = pdf_open_pdi($pdf, "firstfile.pdf", "", 0);
$page= pdf_open_pdi_page($pdf, $pdi, 1, "");

But the script returns an error because of the function "pdf_open_pdi" returned a 0 handle. The file "firstfile.pdf" was there in the right path. I want to know why the function returns a handle 0. Because of this I could not use this document handle in the function "pdf_open_pdi_page".

If iam not in the right path please advice me how to count the number of words in a pdf document that exists in the web server.

Your thoughts and advice on this would be greatly appreciated.

Thanks in advance.

All times are GMT -4. The time now is 09:12 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.