OZONE Asylum
FAQ
How do I search PDF-files with PHP?
This page's ID:
21295
Search
QuickChanges
Forums
FAQ
Archives
Register
You are editing "How do I search PDF-files with PHP?"
Who can edit an FAQ?
Anyone registered may edit an FAQ.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
To search inside PDF files with PHP usually requires some sort of PDF-package to be installed on your server. I wanted a simpler way and based this on a class from here: http://www.phpclasses.org/browse.html/package/702.html I then did a quickie class that handles a very simple search in different kinds of files. If the file is a pdf it uses the class pdf_search. As you instansiate the class pass the following: A valid path to the directory you want to search incl trailing "/" A string of words to search for separated with a space. (this class searches like this <word> OR <word> OR <word>...) A 0 (zero) for non-recursive directory I don't have time right now to be able to handle recursive searches from the given directory. Last invoke the method searchInFile(); That's about it. Oh, IMPORTANT! This seems to work fine on Linux BUT... The pdf search part will not work on Windows, at least not with a default php 4.23 installation from phpdev. It either chrashes on the "gzuncompress()" or as it parses the regexp in the method textline() Don't know why. Examples are in the code. See output: http://www.dmsproject.com/test/pdf/searchDoc.php See code: http://www.dmsproject.com/test/pdf/searchDoc.phps Have fun :) Dan [small](Created by [internallink=582]DmS[/internallink] on 04-11-2004 12:20)[/small]
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »