From a24df7f14413f2652b7222ab1763c8c32ba64a8c Mon Sep 17 00:00:00 2001 From: dave Date: Tue, 30 Mar 2010 07:02:15 +0000 Subject: [PATCH] Change header size, add custom footer. --- tcpdf.inc.php | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/tcpdf.inc.php b/tcpdf.inc.php index 40f5fa89..2a87a0a1 100644 --- a/tcpdf.inc.php +++ b/tcpdf.inc.php @@ -13,6 +13,7 @@ class pdf extends TCPDF { var $label_show_fair, $label_show_box, $label_show_logo; var $current_label_index; + var $footer_string; function __construct($report_name='', $format='LETTER', $orientation='P') { @@ -60,8 +61,8 @@ class pdf extends TCPDF { i18n($report_name)); // set header and footer fonts - $this->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); - $this->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); + $this->setHeaderFont(Array('helvetica', '', 14)); + $this->setFooterFont(Array('helvetica', '', 8)); // set default monospaced font $this->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); @@ -73,7 +74,7 @@ class pdf extends TCPDF { //set auto page breaks $this->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - $this->setPrintFooter(false); + $this->setPrintFooter(TRUE); //set image scale factor $this->setImageScale(PDF_IMAGE_SCALE_RATIO); @@ -82,6 +83,9 @@ class pdf extends TCPDF { $this->current_label_row = 0; $this->current_label_col = 0; + $this->footer_string = date("Y-m-d h:ia").' - '.$report_name; + + //set some language-dependent strings //$this->setLanguageArray($l); //print_r($this->fontlist); @@ -236,6 +240,18 @@ class pdf extends TCPDF { return $this->fontlist; } + function Footer() + { + $ormargins = $this->getOriginalMargins(); + $pagenumtxt = i18n('Page').' '.$this->getAliasNumPage().' / '.$this->getAliasNbPages(); + + $this->SetX($ormargins['left']); + $this->Cell(0, 0, $pagenumtxt, 'T', 0, 'R'); + + $this->SetX($ormargins['left']); + $this->Cell(0, 0, $this->footer_string, 0, 0, 'C'); + } + function setup_for_labels($show_box, $show_fair, $show_logo, $width, $height, $xspacer, $yspacer, $rows, $cols) { /* No headers and footers */