Generate PDF with html2pdf and merged with FPDF y FPDI

214 views
Skip to first unread message

Francisco Andrés Pinzón SantoYo

unread,
May 17, 2013, 5:12:50 PM5/17/13
to comuni...@googlegroups.com
Hi all, I have generated a pdf from a template. Tpl. tpl template converíi a. pdf with html2pdf library.
Now what I want is to take two or more. Pdf files created that way and make them into one. Pdf.
I'm trying with FPDF and FPDI basically is with the latter, trying to bring them together with a procedure, but
I generate a document with a blank sheet.

This is the procedure that supposedly takes passed by parameter files and links:

<?PHP
session_start();
// Turn up error reporting
error_reporting (E_ALL|E_STRICT);
/*
 * Incluir Librerias FPDF
 */
require(APPLICATION_PATH . '/../library/fpdf/fpdf.php');
require(APPLICATION_PATH . '/../library/fpdi/fpdi.php');
ob_start();
class ConcatenarDocumentos extends FPDI
{
    //private $_files = array();
    
    var $_files = array();

    public function setFiles($files) { 
        $this->_files = $files; 
    } 

    public function concat() {
        foreach($this->files AS $file) {
            $pagecount = $this->setSourceFile($file);
            for ($i = 1; $i <= $pagecount; $i  ) {
                $tplidx = $this->ImportPage($i);
                $s = $this->getTemplateSize($tplidx);
                $this->AddPage($s['w'] > $s['h'] ? 'L' : 'P', array($s['w'], $s['h']));
                $this->useTemplate($tplidx);
            }
        }
    }

}

Thanks in advance.
Reply all
Reply to author
Forward
0 new messages