Ver Mensaje Individual
  #9 (permalink)  
Antiguo 16/07/2009, 15:30
Avatar de wpersei
wpersei
 
Fecha de Ingreso: septiembre-2006
Ubicación: Bogota
Mensajes: 189
Antigüedad: 17 años, 8 meses
Puntos: 1
Respuesta: ya inventaron alguna libreria facil de usar para hacer reportes en PHP?

Cita:
Iniciado por maycolalvarez Ver Mensaje
Bueno, es que para reportes web no se ha creado algo tan completo (al menos que yo sepa) como cristal reports, agatha si es para php, pero para PHP-GTK en realidad, es decir, para php con interfaces de usuario tipo window, fpdf es tu mejor opcion, ya que te permite configurar el resultado a tu antojo, porque hacer landscape automático con html es todavía un sueño... y con fpdf es genial, les paso este codigo mágnifico que encontre hace tiempo para que el pdf muestre el dialogo imprimir automáticamente:

Código PHP:
<?php
class PDF_Javascript extends FPDF {

    var 
$javascript;
    var 
$n_js;
    
    function 
__construct($orientation='P',$uni='mm',$format='Letter') {
        
parent::__construct($orientation,$uni,$format);
    }
    function 
IncludeJS($script) {
        
$this->javascript=$script;
    }
    function 
_putjavascript() {
        
$this->_newobj();
        
$this->n_js=$this->n;
        
$this->_out('<<');
        
$this->_out('/Names [(EmbeddedJS) '.($this->n+1).' 0 R ]');
        
$this->_out('>>');
        
$this->_out('endobj');
        
$this->_newobj();
        
$this->_out('<<');
        
$this->_out('/S /JavaScript');
        
$this->_out('/JS '.$this->_textstring($this->javascript));
        
$this->_out('>>');
        
$this->_out('endobj');
    }
    function 
_putresources() {
        
parent::_putresources();
        if (!empty(
$this->javascript)) {
            
$this->_putjavascript();
        }
    }
    function 
_putcatalog() {
        
parent::_putcatalog();
        if (isset(
$this->javascript)) {
            
$this->_out('/Names <</JavaScript '.($this->n_js).' 0 R>>');
        }
    }
}

class 
PDF_AutoPrint extends PDF_Javascript
{
    function 
__construct($orientation='P',$uni='mm',$format='Letter') {
        
parent::__construct($orientation,$uni,$format);
    }
    function 
AutoPrint($dialog=false)
    {    
        
$param=($dialog 'true' 'false');
        
$script="print(".$param.");";
        
$this->IncludeJS($script);
    }
}
?>
solo lo incluyen junto con el fpdf, crean la instancia con la calse PDF_AutoPrint y establecen a true con el método: AutoPrint

Gracias por este codigo en realidad es algo que puede ser muy util....

donde lo conseguiste??

saludos
__________________
www.ogallardo.com - Mi blog