public function W2PDF::Footer in Webform2PDF 6
Same name and namespace in other branches
- 6.2 webform2pdf.class.inc \W2PDF::Footer()
- 7.4 webform2pdf.class.inc \W2PDF::Footer()
- 7.3 webform2pdf.class.inc \W2PDF::Footer()
This method is used to render the page footer. It is automatically called by AddPage() and could be overwritten in your own inherited class.
File
- ./
webform2pdf.class.inc, line 173
Class
Code
public function Footer() {
$ormargins = $this
->getOriginalMargins();
$footerfont = $this
->getFooterFont();
$footerdata = $this
->getFooterData();
$imgy['left'] = $imgy['right'] = $this
->GetY();
$footer_w = 0;
$empty_footer = 1;
// $footer_height = $cell_height = count( explode("\n", $footerdata['string']) ) * round(($this->getCellHeightRatio() * $footerfont[2]) / $this->getScaleFactor(), 2);
$cell_height = 18;
if (!empty($footerdata['logo_size']['left']['h']) || !empty($footerdata['logo_size']['right']['h'])) {
// $footer_height = max($cell_height, $footerdata['logo_size']['left']['h'], $footerdata['logo_size']['right']['h']);
$this
->SetY($this
->GetY() - $cell_height);
}
else {
$this
->SetY($this
->GetY() - $cell_height);
}
if (!empty($footerdata['logo']['left']) && !empty($footerdata['logo_size']['left']['w'])) {
if ($footerdata['logo']['left'] and $footerdata['logo']['left'] != K_BLANK_IMAGE) {
$this
->Image(K_PATH_IMAGES . $footerdata['logo']['left'], $this
->GetX(), $this
->GetY(), $footerdata['logo_size']['left']['w']);
$imgy['left'] = $this
->getImageRBY();
$empty_footer = 0;
}
}
if (!empty($footerdata['logo']['left']) && !empty($footerdata['logo_size']['left']['w'])) {
if ($footerdata['logo']['right'] and $footerdata['logo']['right'] != K_BLANK_IMAGE) {
$this
->Image(K_PATH_IMAGES . $footerdata['logo']['right'], $this
->getPageWidth() - $ormargins['right'] - $footerdata['logo_size']['right']['w'], $this
->GetY(), $footerdata['logo_size']['right']['w']);
$footer_w = $this
->getPageWidth() - $ormargins['left'] - $ormargins['right'] - $footerdata['logo_size']['left']['w'] * 1.1 - $footerdata['logo_size']['right']['w'] * 1.1;
$imgy['right'] = $this
->getImageRBY();
$empty_footer = 0;
}
}
$this
->SetTextColor(0, 0, 0);
$this
->SetY($this
->GetY() - 1);
// set starting margin for text data cell
if ($this
->getRTL()) {
$footer_x = $ormargins['right'] + $footerdata['logo_size']['right']['w'] * 1.1;
}
else {
$footer_x = $ormargins['left'] + $footerdata['logo_size']['left']['w'] * 1.1;
}
$this
->SetX($footer_x);
$line_width = 0.85 / $this
->getScaleFactor();
// print an ending footer line
$this
->SetLineStyle(array(
'width' => $line_width,
'cap' => 'butt',
'join' => 'miter',
'dash' => 0,
'color' => array(
0,
0,
0,
),
));
// footer html string
$page_var = array(
"%pagenumber" => $this
->PageNoFormatted(),
"%totalpage" => $this
->getAliasNbPages(),
);
$footerdata['string'] = strtr($footerdata['string'], $page_var);
$this
->SetFont($footerfont[0], $footerfont[1], $footerfont[2]);
if (!empty($footerdata['string'])) {
$empty_footer = 0;
}
$this
->writeHTMLCell($footer_w, $cell_height, '', '', $footerdata['string'], 0, 0, 0, TRUE, $footerdata['align']);
if ($this
->getRTL()) {
$this
->SetX($ormargins['right']);
}
else {
$this
->SetX($ormargins['left']);
}
if (!$empty_footer) {
$this
->Cell(0, 0, '', 'T', 0, 'C');
}
}