/** * 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 = HTML2PDF_locale::get('pdf05'); } if ($this->_footerParam['date'] && $this->_footerParam['hour']) { $txt .= ($txt ? ' - ' : '') . HTML2PDF_locale::get('pdf03'); } if ($this->_footerParam['date'] && !$this->_footerParam['hour']) { $txt .= ($txt ? ' - ' : '') . HTML2PDF_locale::get('pdf01'); } if (!$this->_footerParam['date'] && $this->_footerParam['hour']) { $txt .= ($txt ? ' - ' : '') . HTML2PDF_locale::get('pdf02'); } if ($this->_footerParam['page']) { $txt .= ($txt ? ' - ' : '') . HTML2PDF_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'); } }
/** * display the content in HTML moden for debug * * @access protected * @param string $contenu */ protected function _vueHTML($content) { $content = preg_replace('/<page_header([^>]*)>/isU', '<hr>' . HTML2PDF_locale::get('vue01') . ' : $1<hr><div$1>', $content); $content = preg_replace('/<page_footer([^>]*)>/isU', '<hr>' . HTML2PDF_locale::get('vue02') . ' : $1<hr><div$1>', $content); $content = preg_replace('/<page([^>]*)>/isU', '<hr>' . HTML2PDF_locale::get('vue03') . ' : $1<hr><div$1>', $content); $content = preg_replace('/<\\/page([^>]*)>/isU', '</div><hr>', $content); $content = preg_replace('/<bookmark([^>]*)>/isU', '<hr>bookmark : $1<hr>', $content); $content = preg_replace('/<\\/bookmark([^>]*)>/isU', '', $content); $content = preg_replace('/<barcode([^>]*)>/isU', '<hr>barcode : $1<hr>', $content); $content = preg_replace('/<\\/barcode([^>]*)>/isU', '', $content); $content = preg_replace('/<qrcode([^>]*)>/isU', '<hr>qrcode : $1<hr>', $content); $content = preg_replace('/<\\/qrcode([^>]*)>/isU', '', $content); echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>' . HTML2PDF_locale::get('vue04') . ' HTML</title> <meta http-equiv="Content-Type" content="text/html; charset=' . $this->_encoding . '" > </head> <body style="padding: 10px; font-size: 10pt;font-family: Verdana;"> ' . $content . ' </body> </html>'; exit; }
/** * generate a HTML2PDF exception * * @param int $err error number * @param mixed $other additionnal informations * @return string $html optionnal code HTML associated to the error */ public final function __construct($err = 0, $other = null, $html = '') { // read the error switch ($err) { case 1: // Unsupported tag $msg = HTML2PDF_locale::get('err01'); $msg = str_replace('[[OTHER]]', $other, $msg); $this->_tag = $other; break; case 2: // too long sentence $msg = HTML2PDF_locale::get('err02'); $msg = str_replace('[[OTHER_0]]', $other[0], $msg); $msg = str_replace('[[OTHER_1]]', $other[1], $msg); $msg = str_replace('[[OTHER_2]]', $other[2], $msg); break; case 3: // closing tag in excess $msg = HTML2PDF_locale::get('err03'); $msg = str_replace('[[OTHER]]', $other, $msg); $this->_tag = $other; break; case 4: // tags closed in the wrong order $msg = HTML2PDF_locale::get('err04'); $msg = str_replace('[[OTHER]]', print_r($other, true), $msg); break; case 5: // unclosed tag $msg = HTML2PDF_locale::get('err05'); $msg = str_replace('[[OTHER]]', print_r($other, true), $msg); break; case 6: // image can not be loaded $msg = HTML2PDF_locale::get('err06'); $msg = str_replace('[[OTHER]]', $other, $msg); $this->_image = $other; break; case 7: // too big TD content $msg = HTML2PDF_locale::get('err07'); break; case 8: // SVG tag not in DRAW tag $msg = HTML2PDF_locale::get('err08'); $msg = str_replace('[[OTHER]]', $other, $msg); $this->_tag = $other; break; case 9: // deprecated $msg = HTML2PDF_locale::get('err09'); $msg = str_replace('[[OTHER_0]]', $other[0], $msg); $msg = str_replace('[[OTHER_1]]', $other[1], $msg); $this->_tag = $other[0]; break; case 0: // specific error // specific error default: $msg = $other; break; } // create the HTML message $this->_messageHtml = '<span style="color: #AA0000; font-weight: bold;">' . HTML2PDF_locale::get('txt01', 'error: ') . $err . '</span><br>'; $this->_messageHtml .= HTML2PDF_locale::get('txt02', 'file:') . ' ' . $this->file . '<br>'; $this->_messageHtml .= HTML2PDF_locale::get('txt03', 'line:') . ' ' . $this->line . '<br>'; $this->_messageHtml .= '<br>'; $this->_messageHtml .= $msg; // create the text message $msg = HTML2PDF_locale::get('txt01', 'error: ') . $err . ' : ' . strip_tags($msg); // add the optionnal html content if ($html) { $this->_messageHtml .= "<br><br>HTML : ..." . trim(htmlentities($html)) . '...'; $this->_html = $html; $msg .= ' HTML : ...' . trim($html) . '...'; } // save the other informations $this->_other = $other; // construct the exception parent::__construct($msg, $err); }