Re: can i read pdf by php

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> http://www.phpclasses.org/browse/package/702.html
it is not correctable, someone test this class whether work or not

class pdf_search {

        // Just one private variable.
        // It holds the document.
        var $_buffer;

        // Constructor. Takes the pdf document as only parameter
        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;
        }

        // This function returns the next line in the document that 
is printable text.
        // We need it so we can search in just that portion.
        function textline() {
                $line = $this->nextline();                
				if ($line === false) {
                        return false;
                }
                if (preg_match("/[^\\\\]\\((.+)[^\\\\]\\)/", $line, 
$match)) {
                       	$line = preg_replace("/\\\\(\d+)/e", "chr(0
\\1);", $match[1]);                        			
			
						return stripslashes
($line);						
				}				
                return $this->textline();
        }

        // This function returns true or false, indicating whether 
the document contains
        // the text that is passed in $str.
        function textfound($str) {
				$line = $this->textline();
				
                while (($line = $this->textline())!== false) {
                       echo $line;
						if (preg_match("/
$str/i", $line) != 0) {
                                return true;
                        }
                }
                return false;
        }
}



------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~-> 

PHP Data object relational mapping generator - http://www.meta-language.net/ 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-objects/

<*> To unsubscribe from this group, send an email to:
    php-objects-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux