예제 #1
0
 /**
  * class constructor
  *
  * @access public
  * @param  string   $orientation page orientation, same as TCPDF
  * @param  mixed    $format      The format used for pages, same as TCPDF
  * @param  string   $langue      Lang : fr, en, it...
  * @param  boolean  $unicode     TRUE means that the input text is unicode (default = true)
  * @param  String   $encoding    charset encoding; default is UTF-8
  * @param  array    $marges      Default margins (left, top, right, bottom)
  * @return Html2Pdf $this
  */
 public function __construct($orientation = 'P', $format = 'A4', $langue = 'fr', $unicode = true, $encoding = 'UTF-8', $marges = array(5, 5, 5, 8))
 {
     // init the page number
     $this->_page = 0;
     $this->_firstPage = true;
     // save the parameters
     $this->_orientation = $orientation;
     $this->_format = $format;
     $this->_langue = strtolower($langue);
     $this->_unicode = $unicode;
     $this->_encoding = $encoding;
     // load the Locale
     Locale::load($this->_langue);
     // create the  myPdf object
     $this->pdf = new MyPdf($orientation, 'mm', $format, $unicode, $encoding);
     // init the CSS parsing object
     $this->parsingCss = new Parsing\Css($this->pdf);
     $this->parsingCss->fontSet();
     $this->_defList = array();
     // init some tests
     $this->setTestTdInOnePage(true);
     $this->setTestIsImage(true);
     // init the default font
     $this->setDefaultFont(null);
     $this->lexer = new HtmlLexer();
     // init the HTML parsing object
     $this->parsingHtml = new Parsing\Html($this->_encoding);
     $this->_subHtml = null;
     $this->_subPart = false;
     // init the marges of the page
     if (!is_array($marges)) {
         $marges = array($marges, $marges, $marges, $marges);
     }
     $this->_setDefaultMargins($marges[0], $marges[1], $marges[2], $marges[3]);
     $this->_setMargins();
     $this->_marges = array();
     // init the form's fields
     $this->_lstField = array();
     $this->addExtension(new CoreExtension());
     return $this;
 }
예제 #2
0
파일: MyPdf.php 프로젝트: vienis/html2pdf
 /**
  * This function is call automatically by TCPDF at the end of a page
  * It takes no parameters
  *
  * @access public
  */
 public function Footer()
 {
     // prepare the text from the tranlated text
     $txt = '';
     if ($this->_footerParam['form']) {
         $txt = Locale::get('pdf05');
     }
     if ($this->_footerParam['date'] && $this->_footerParam['hour']) {
         $txt .= ($txt ? ' - ' : '') . Locale::get('pdf03');
     }
     if ($this->_footerParam['date'] && !$this->_footerParam['hour']) {
         $txt .= ($txt ? ' - ' : '') . Locale::get('pdf01');
     }
     if (!$this->_footerParam['date'] && $this->_footerParam['hour']) {
         $txt .= ($txt ? ' - ' : '') . Locale::get('pdf02');
     }
     if ($this->_footerParam['page']) {
         $txt .= ($txt ? ' - ' : '') . Locale::get('pdf04');
     }
     if (strlen($txt) > 0) {
         // replace some values
         $toReplace = array('[[date_d]]' => date('d'), '[[date_m]]' => date('m'), '[[date_y]]' => date('Y'), '[[date_h]]' => date('H'), '[[date_i]]' => date('i'), '[[date_s]]' => date('s'), '[[page_cu]]' => $this->getMyNumPage(), '[[page_nb]]' => $this->getMyAliasNbPages());
         $txt = str_replace(array_keys($toReplace), array_values($toReplace), $txt);
         // draw the footer
         parent::SetY(-11);
         $this->SetFont('helvetica', 'I', 8);
         $this->Cell(0, 10, $txt, 0, 0, 'R');
     }
 }