Revision: 54661
                            
                                                            
                                    
                                        
Updated Code
                                    
                                    
                                                    
                        at January 6, 2012 07:54 by juanaco1
                            
                            Updated Code
// a la funcion se le pasa un array con la ruta del archivo 
function getNumPagesInPDF(array $arguments = array()) {
        @list($PDFPath) = $arguments;
	$stream = @fopen($PDFPath, "r");
	$PDFContent = @fread ($stream, filesize($PDFPath));
	if(!$stream || !$PDFContent)
   		return false;
    
		$firstValue = 0;
		$secondValue = 0;
	if(preg_match("/\/N\s+([0-9]+)/", $PDFContent, $matches)) {
    	$firstValue = $matches[1];
	}
 
	if(preg_match_all("/\/Count\s+([0-9]+)/s", $PDFContent, $matches)) {
   	$secondValue = max($matches[1]);
        }
	return (($secondValue != 0) ? $secondValue : max($firstValue, $secondValue));
}
			
$arrayGuay = array("ruta_archivo_pdf");
echo getNumPagesInPDF($arrayGuay);
                                
                            Revision: 54660
                            
                                                            
                                    
                                        
Initial Code
                                    
                                    
                                                            
                                    
                                        
Initial URL
                                    
                                    
                                
                                                            
                                    
                                        
Initial Description
                                    
                                    
                                                            
                                    
                                        
Initial Title
                                    
                                    
                                                            
                                    
                                        
Initial Tags
                                    
                                    
                                
                                                            
                                    
                                        
Initial Language
                                    
                                    
                                                    
                        at January 6, 2012 07:52 by juanaco1
                            
                            Initial Code
// a la funcion se le pasa un array con la ruta del archivo 
			function getNumPagesInPDF(array $arguments = array()) {
				@list($PDFPath) = $arguments;
				$stream = @fopen($PDFPath, "r");
				$PDFContent = @fread ($stream, filesize($PDFPath));
				if(!$stream || !$PDFContent)
   					return false;
    
					$firstValue = 0;
					$secondValue = 0;
				if(preg_match("/\/N\s+([0-9]+)/", $PDFContent, $matches)) {
    				$firstValue = $matches[1];
				}
 
				if(preg_match_all("/\/Count\s+([0-9]+)/s", $PDFContent, $matches))
				{
   				$secondValue = max($matches[1]);
				}
				return (($secondValue != 0) ? $secondValue : max($firstValue, $secondValue));
			}
			
			$arrayGuay = array("ruta_archivo_pdf");
			echo getNumPagesInPDF($arrayGuay);F($arrayGuay);
                                Initial URL
Initial Description
esta funcion devuelve las paginas de un archivo pdf dado. se le pasa un array con la ruta del archivo.
Initial Title
paginas de un documento pdf
Initial Tags
Initial Language
PHP