Page 1 of 1

how to search in pdf files using php predefined classes?

Posted: Tue Jan 15, 2008 6:49 am
by hannnndy
hi,

I have no idea how to search in pdf files have you any idea or suggestion or even function that can help me doing so?

please leave me a simple sample codes to understand?

Code: Select all

function pdf_search($buffer) {
$this->_buffer = $buffer;
}
 
// This function returns the next line from the document. If a stream follows, it is deflated into readable text.
function nextline() {
$pos = strpos($this->_buffer, "\r");
if ($pos === false) {
return false;
}
$line = substr($this->_buffer, 0, $pos);
$this->_buffer = substr($this->_buffer, $pos + 1);
 
if ($line == "stream") {
$endpos = strpos($this->_buffer, "endstream");
$stream = substr($this->_buffer, 1, $endpos - 1);
$stream = @gzuncompress($stream);
$this->_buffer = $stream . substr($this->_buffer, $endpos + 9);
}
return $line;
}
is there any better way to do so?

Re: how to search in pdf files using php predefined classes?

Posted: Tue Jan 15, 2008 3:08 pm
by Ambush Commander

Re: how to search in pdf files using php predefined classes?

Posted: Wed Jan 16, 2008 2:04 am
by hannnndy
thanks for reply
Actually that would not help me because it is a little complex I need something object oriented like a class
and calling only a method of it have you any better idea?

Re: how to search in pdf files using php predefined classes?

Posted: Wed Jan 16, 2008 12:35 pm
by Ambush Commander
As far as I can tell, PDFlib is OO...

There might be some pure PHP PDF reading classes to use, but most of the ones out there are for generating PDFs.

Re: how to search in pdf files using php predefined classes?

Posted: Thu Jan 17, 2008 12:12 am
by hannnndy
so have you any idea for me what to do?

Re: how to search in pdf files using php predefined classes?

Posted: Thu Jan 17, 2008 3:56 pm
by Ambush Commander
I don't know what you want to do. Therefore, I can't say. :-)

Re: how to search in pdf files using php predefined classes?

Posted: Sat Jan 19, 2008 11:26 am
by hannnndy
easily there is a pdf file named name.pdf

I need afunction to open that and find the specific string in it like "sample text" and gives me the count of the string in df file or even the page string occured in it

just this nothing more !!!