Ver Mensaje Individual
  #6 (permalink)  
Antiguo 22/01/2007, 15:50
Avatar de alvgutierr
alvgutierr
 
Fecha de Ingreso: mayo-2006
Ubicación: Santiago Chile
Mensajes: 42
Antigüedad: 18 años
Puntos: 0
Re: Imprimir un PDF

Ocupa esta clase
OJO USANDO LA LIBRERIA FPDF

Código PHP:
<?php
require('fpdf.php');

class 
PDF_Javascript extends FPDF {

    var 
$javascript;
    var 
$n_js;

    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>>');
        }
    }
}
?>