Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 16th, 2003, 06:51 AM
Registered User
Join Date: Oct 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to basil123 Send a message via Yahoo to basil123
Default 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.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Count the number of words in a PDF document basil123 Pro PHP 5 May 27th, 2009 01:00 AM
convert number into words on acces form superparim Wrox Book Feedback 0 September 19th, 2005 01:55 PM
count the TOTAL number of segments crmpicco Classic ASP Basics 2 February 1st, 2005 05:03 AM
Words Document maha HTML Code Clinic 8 September 29th, 2004 03:08 AM
Changing number to words kekohchaa VS.NET 2002/2003 3 April 7th, 2004 11:27 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.