Allow set PDF footer from tpl - refs BT#12441

pull/2487/head
Angel Fernando Quiroz Campos 9 years ago
parent 8ff55e2077
commit 29a47c19a1
  1. 18
      app/Resources/public/css/print.css
  2. 71
      main/inc/lib/pdf.lib.php
  3. 10
      main/template/default/export/pdf_footer.tpl

@ -691,3 +691,21 @@ table.border-thin td {
.text-center { .text-center {
text-align: center; text-align: center;
} }
.text-left {
text-align: left;
}
.text-right {
text-align: right;
}
table.page-footer {
font-family: serif;
font-size: 10pt;
}
table.page-footer td{
padding: 0;
}
.border-top {
border-top: 1px solid #000;
}

@ -622,67 +622,16 @@ class PDF
*/ */
public function set_footer() public function set_footer()
{ {
$this->pdf->defaultfooterfontsize = 12; // in pts $this->pdf->defaultfooterfontsize = 12; // in pts
$this->pdf->defaultfooterfontstyle = 'B'; // blank, B, I, or BI $this->pdf->defaultfooterfontstyle = 'B'; // blank, B, I, or BI
$this->pdf->defaultfooterline = 1; // 1 to include line below header/above footer $this->pdf->defaultfooterline = 1; // 1 to include line below header/above footer
$platform_name = api_get_setting('Institution');
$left_content = $platform_name; $view = new Template('', false, false, false, true, false, false);
$center_content = ''; $template = $view->get_template('export/pdf_footer.tpl');
$right_content = '{PAGENO} / {nb}'; $footerHTML = $view->fetch($template);
//@todo remove this and use a simpler way $this->pdf->SetHTMLFooter($footerHTML, 'E'); //Even pages
$footer = array( $this->pdf->SetHTMLFooter($footerHTML, 'O'); //Odd pages
'odd' => array(
'L' => array(
'content' => $left_content,
'font-size' => 10,
'font-style' => 'B',
'font-family' => 'serif',
'color' => '#000000'
),
'C' => array(
'content' => $center_content,
'font-size' => 10,
'font-style' => 'B',
'font-family' => 'serif',
'color' => '#000000'
),
'R' => array(
'content' => $right_content,
'font-size' => 10,
'font-style' => 'B',
'font-family' => 'serif',
'color' => '#000000'
),
'line' => 1,
),
'even' => array(
'L' => array(
'content' => $left_content,
'font-size' => 10,
'font-style' => 'B',
'font-family' => 'serif',
'color' => '#000000'
),
'C' => array(
'content' => $center_content,
'font-size' => 10,
'font-style' => 'B',
'font-family' => 'serif',
'color' => '#000000'
),
'R' => array(
'content' => $right_content,
'font-size' => 10,
'font-style' => 'B',
'font-family' => 'serif',
'color' => '#000000'
),
'line' => 1,
),
);
// defines footer for Odd and Even Pages - placed at Outer margin see http://mpdf1.com/manual/index.php?tid=151&searchstring=setfooter
$this->pdf->SetFooter($footer);
} }
/** /**

@ -0,0 +1,10 @@
<table border="0" class="full-width border-top page-footer">
<tr>
<td class="text-left">
<strong>{{ _s.institution }}</strong>
</td>
<td class="text-right">
<strong>{PAGENO} / {nb}</strong>
</td>
</tr>
</table>
Loading…
Cancel
Save