本文整理汇总了PHP中mPDF::purify_utf8方法的典型用法代码示例。如果您正苦于以下问题:PHP mPDF::purify_utf8方法的具体用法?PHP mPDF::purify_utf8怎么用?PHP mPDF::purify_utf8使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mPDF
的用法示例。
在下文中一共展示了mPDF::purify_utf8方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderPdf
protected function renderPdf($html, $filename, $options)
{
$this->_helper->viewRenderer->setNoRender();
$margin_left = isset($options['margins']['left']) ? $options['margins']['left'] : 15;
$margin_right = isset($options['margins']['right']) ? $options['margins']['right'] : 15;
$margin_top = isset($options['margins']['top']) ? $options['margins']['top'] : 15;
$margin_bottom = isset($options['margins']['bottom']) ? $options['margins']['bottom'] : 15;
$margin_header = isset($options['margins']['header']) ? $options['margins']['header'] : 15;
$margin_footer = isset($options['margins']['footer']) ? $options['margins']['footer'] : 15;
$format = isset($options['format']) ? $options['format'] : 'A4-L';
$output_mode = isset($options['output']) ? $options['output'] : 'D';
define('_MPDF_URI', APPLICATION_PATH . '/../library/MPDF54/');
define('_MPDF_TEMP_PATH', '/var/www/tm/');
require_once APPLICATION_PATH . "/../library/MPDF54/mpdf.php";
/* argumentos:
* mode: codificacao (basicamente)
* format: formato da pagina (pode ser adicionado -L depois do formato para forcar modo paisagem
* tamanho da fonte: e passado 0 para que o tamanho seja setado no arquivo CSS
* fonte
* margin_left
* margin_right
* margin_top
* margin_bottom
* margin_header
* margin_footer
*/
$mpdf = new mPDF('utf-8', $format, 0, '', $margin_left, $margin_right, $margin_top, $margin_bottom, $margin_header, $margin_footer);
$mpdf->ignore_invalid_utf8 = true;
$mpdf->charset_in = 'utf-8';
$mpdf->SetDisplayMode('fullpage', 'two');
$mpdf->WriteHTML($mpdf->purify_utf8($html));
$mpdf->Output($filename . '.pdf', $output_mode);
exit;
}
示例2: renderPdf
/**
* Gerar PDF
*
* @param string $sHtml
* @param string $sFilename
* @param array $aOptions
* @return string
*/
public static function renderPdf($sHtml, $sFilename, $aOptions)
{
$aOptions['margins']['left'] = isset($aOptions['margins']['left']) ? $aOptions['margins']['left'] : 5;
$aOptions['margins']['right'] = isset($aOptions['margins']['right']) ? $aOptions['margins']['right'] : 5;
$aOptions['margins']['top'] = isset($aOptions['margins']['top']) ? $aOptions['margins']['top'] : 5;
$aOptions['margins']['bottom'] = isset($aOptions['margins']['bottom']) ? $aOptions['margins']['bottom'] : 5;
$aOptions['margins']['header'] = isset($aOptions['margins']['header']) ? $aOptions['margins']['header'] : 5;
$aOptions['margins']['footer'] = isset($aOptions['margins']['footer']) ? $aOptions['margins']['footer'] : 5;
$aOptions['format'] = isset($aOptions['format']) ? $aOptions['format'] : 'A4-L';
$aOptions['output'] = isset($aOptions['output']) ? $aOptions['output'] : 'D';
/**
* Argumentos:
* ------------------------------------------------------------------------------------------------
* charset: (utf-8)
* format: formato da pagina (pode ser adicionado -L depois do formato para forcar modo paisagem
* tamanho da fonte: e passado 0 para que o tamanho seja setado no arquivo CSS
* fonte
* margin_left
* margin_right
* margin_top
* margin_bottom
* margin_header
* margin_footer
*/
$oMpdf = new mPDF('utf-8', $aOptions['format'], 0, '', $aOptions['margins']['left'], $aOptions['margins']['right'], $aOptions['margins']['top'], $aOptions['margins']['bottom'], $aOptions['margins']['header'], $aOptions['margins']['footer']);
$oMpdf->ignore_invalid_utf8 = true;
$oMpdf->charset_in = 'utf-8';
$oMpdf->SetDisplayMode('fullpage', 'two');
$oMpdf->WriteHTML($oMpdf->purify_utf8($sHtml));
$oMpdf->Output($sFilename . '.pdf', $aOptions['output']);
return $sFilename;
}
示例3: renderPdf
/**
* Gerar PDF através do HTML informado
*
* @param string $sHtml
* @param string $sFilename
* @param array $aOptions
* $aOptions['margins']['left'] = 15;
* $aOptions['margins']['right'] = 15;
* $aOptions['margins']['top'] = 15;
* $aOptions['margins']['bottom'] = 15;
* $aOptions['margins']['header'] = 15;
* $aOptions['margins']['footer'] = 15;
* $aOptions['format'] = 'A4-L';
* $aOptions['output'] = 'D'; // 'D' = Download | 'F' = Salva o arquivo
*/
protected function renderPdf($sHtml, $sFilename, $aOptions)
{
self::noLayout();
$aOptions['margins']['left'] = isset($aOptions['margins']['left']) ? $aOptions['margins']['left'] : 15;
$aOptions['margins']['right'] = isset($aOptions['margins']['right']) ? $aOptions['margins']['right'] : 15;
$aOptions['margins']['top'] = isset($aOptions['margins']['top']) ? $aOptions['margins']['top'] : 15;
$aOptions['margins']['bottom'] = isset($aOptions['margins']['bottom']) ? $aOptions['margins']['bottom'] : 15;
$aOptions['margins']['header'] = isset($aOptions['margins']['header']) ? $aOptions['margins']['header'] : 15;
$aOptions['margins']['footer'] = isset($aOptions['margins']['footer']) ? $aOptions['margins']['footer'] : 15;
$aOptions['format'] = isset($aOptions['format']) ? $aOptions['format'] : 'A4-L';
$aOptions['output'] = isset($aOptions['output']) ? $aOptions['output'] : 'D';
define('_MPDF_URI', LIBRARY_PATH . '/MPDF54/');
define('_MPDF_TEMP_PATH', TEMP_PATH . '/');
require_once LIBRARY_PATH . '/MPDF54/mpdf.php';
$oMpdf = new mPDF('utf-8', $aOptions['format'], 0, '', $aOptions['margins']['left'], $aOptions['margins']['right'], $aOptions['margins']['top'], $aOptions['margins']['bottom'], $aOptions['margins']['header'], $aOptions['margins']['footer']);
$oMpdf->ignore_invalid_utf8 = TRUE;
$oMpdf->charset_in = 'utf-8';
$oMpdf->SetDisplayMode('fullpage', 'two');
$oMpdf->WriteHTML($oMpdf->purify_utf8($sHtml));
$oMpdf->Output("{$sFilename}.pdf", $aOptions['output']);
exit;
}