public function ViewsPdfBase::Close in Views PDF 8
Close the document. This is called automatically by \TCPDF::Output().
File
- src/
ViewsPdfBase.php, line 1013 - Contains \Drupal\views_pdf\ViewsPdfTemplate.
Class
- ViewsPdfBase
- The main class to generate the PDF.
Namespace
Drupal\views_pdfCode
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();
}