19 require_once(BASE.
"wcmf/lib/output/pdf/class.PDF.php");
20 require_once(BASE.
"wcmf/lib/core/class.WCMFException.php");
69 if (!isset($pdf) || ((strtolower(get_class($pdf)) !=
'pdf' && !is_a($pdf,
'PDF'))))
70 $this->_pdf =
new PDF();
81 $this->_tpl = $filename;
94 function setPages($pages, $cycle=
false, $data=null)
96 $this->_pages = $pages;
97 $this->_cycle = $cycle;
98 $this->_data = &$data;
110 if ($this->_tpl == null)
117 $numPages = $this->_pdf->setSourceFile($this->_tpl);
118 for ($i=1; $i<=$numPages; $i++)
121 $tplIndex = $this->_pdf->ImportPage($i);
122 $size = $this->_pdf->getTemplatesize($tplIndex);
123 $this->_pdf->AddPage($size[
'h'] > $size[
'w'] ?
'P' :
'L');
126 if ($pageIndex <
sizeof($this->_pages))
128 $curPage = &$this->_pages[$pageIndex];
129 if (strtolower(get_class($curPage)) ==
'pdfpage' || is_a($curPage,
'PDFPage'))
131 $this->_pdf->startPage();
132 $curPage->render($this->_pdf, $i, $this->_data);
133 $this->_pdf->endPage();
139 if ($this->_cycle && $pageIndex ==
sizeof($this->_pages))
144 return $this->_pdf->Output($name, $dest);
PDFTemplate is used to output pdf files based on a given pdf template. PDFTemplate uses FPDI/FPDF...
throwEx($message, $file='', $line='')
output($name='', $dest='')
setPages($pages, $cycle=false, $data=null)