本文整理汇总了PHP中HTML2PDF_locale类的典型用法代码示例。如果您正苦于以下问题:PHP HTML2PDF_locale类的具体用法?PHP HTML2PDF_locale怎么用?PHP HTML2PDF_locale使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HTML2PDF_locale类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* class constructor
*
* @access public
* @param string $orientation page orientation, same as TCPDF
* @param mixed $format The format used for pages, same as TCPDF
* @param $tring $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 LMSHTML2PDF $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 Local
HTML2PDF_locale::load($this->_langue);
// create the LMSTML2PDF_myPdf object
$this->pdf = new HTML2PDF_myPdf($orientation, 'mm', $format, $unicode, $encoding);
// init the CSS parsing object
$this->parsingCss = new LMSHTML2PDF_parsingCss($this->pdf);
$this->parsingCss->fontSet();
$this->_defList = array();
// init some tests
$this->setTestTdInOnePage(false);
$this->setTestIsImage(true);
$this->setTestIsDeprecated(true);
// init the default font
$this->setDefaultFont(null);
// init the HTML parsing object
$this->parsingHtml = new HTML2PDF_parsingHtml($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();
return $this;
}
示例2: _vueHTML
/**
* 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;
}
示例3: Footer
/**
* 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');
}
}
示例4: __construct
/**
* 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);
}
示例5: clean
/**
* clean the locale
*
* @access public static
*/
public static function clean()
{
self::$_code = null;
self::$_list = array();
}
示例6: clean
/**
* clean the locale
*
* @access public static
*/
public static function clean()
{
self::$_code = null;
self::$_list = [];
}