public function PdfTemplate::Close in Views PDF 6
Same name and namespace in other branches
- 7.3 views_pdf_template.php \PdfTemplate::Close()
- 7 views_pdf_template.php \PdfTemplate::Close()
- 7.2 views_pdf_template.php \PdfTemplate::Close()
Close the document. This is called automatically by TCPDF::Output().
File
- ./
views_pdf_template.php, line 784 - PDF Class to generate PDFs with native PHP. This class based on FPDF and FPDI.
Class
- PdfTemplate
- The main class to generate the PDF.
Code
public function Close() {
// Print the Header & Footer
for ($page = 1; $page <= $this
->getNumPages(); $page++) {
$this
->setPage($page);
if (isset($this->headerFooterData[$page])) {
$record = $this->headerFooterData[$page];
if (is_array($this->headerFooterOptions['formats'])) {
foreach ($this->headerFooterOptions['formats'] as $id => $options) {
if ($options['position']['object'] == 'header_footer') {
$fieldOptions = $options;
$fieldOptions['position']['object'] = 'page';
$this->InFooter = true;
// backup margins
$ml = $this->lMargin;
$mr = $this->rMargin;
$mt = $this->tMargin;
$this
->SetMargins(0, 0, 0);
$this
->drawContent($record, $fieldOptions, $this->view, $id);
$this->InFooter = false;
// restore margins
$this
->SetMargins($ml, $mt, $mr);
}
}
}
}
}
// call parent:
parent::Close();
}