本文整理汇总了PHP中HTML2FPDF::AddGBFont方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML2FPDF::AddGBFont方法的具体用法?PHP HTML2FPDF::AddGBFont怎么用?PHP HTML2FPDF::AddGBFont使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML2FPDF
的用法示例。
在下文中一共展示了HTML2FPDF::AddGBFont方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Pdf_do
public function Pdf_do($config = array())
{
$source_name = $config['name'];
$task_name = $config['output'];
require 'htmlofpdf/html2fpdf.php';
$pdf = new HTML2FPDF();
$pdf->AddGBFont('GB', 'GB2312');
$pdf->AddPage();
$fp = fopen($source_name, "r");
$strContent = fread($fp, filesize($source_name));
fclose($fp);
$pdf->WriteHTML(iconv("UTF-8", "GB2312", $strContent));
ob_clean();
$pdf->Output($task_name, true);
}
示例2: array
$farr = array(
"/\s+/", //过滤多余空白
//过滤 <script>等可能引入恶意内容或恶意改变显示布局的代码,如果不需要插入flash等,还可以加入<object>的过滤
"/<(\/?)(script|i?frame|style|html|body|title|link|meta|INPUT|A|img|\?|\%)([^>]*?)>/isU",
"/(<[^>]*)on[a-zA-Z]+\s*=([^>]*>)/isU",//过滤javascript的on事件
);
$tarr = array(
" ",
"",//如果要直接清除不安全的标签,这里可以留空
"",
);
$str = preg_replace( $farr,$tarr,$str);
return $str;
}
$pdf=new HTML2FPDF();
$pdf->AddGBFont('GB','仿宋_GB2312');
$pdf->SetFontSize('8');
$pdf->AddPage();
$fp = fopen("sample.html","r");
$strContent = fread($fp, filesize("sample.html"));
fclose($fp);
$msg=urldecode($_POST['userdefine']);
$msg=str_replace("class=TableBlock", "border=1", $msg);
$msg=str_replace("class=TableHeader", "bgcolor=#DDDDDD", $msg);
$msg=str_replace("class=TableContent", "bgcolor=#EEEEEE", $msg);
$msg=str_replace("class=TableDatat", "bgcolor=#FFFFFF", $msg);
$msg=str_replace("<tr>", "<TR>", $msg);
$msg=str_replace("</tr>", "</TR>", $msg);
$msg=str_replace("<td", "<TD", $msg);
$msg=str_replace("</td>", "</TD>", $msg);
$msg=str_replace("nowrap", " ", $msg);
示例3: page
<body>
<div align="center"><img src="logo.gif" alt="HTML 2 PDF logo" /></div>
<h2 align="center">HTML 2 PDF Project²âÊÔ</h2>
Below are the descriptions of each MENU button:
<ul>
<li><b><font color="red">HOME</font></b> - Returns to the main page (this one)</li>
<li><b>FEATURES</b> - Explains the script's main features</li>
<li><b>EXAMPLES</b> - A series of examples in which the script works</li>
<li><b>CLASS-DOC</b> - Some documentation about the used classes</li>
<li><b>LICENSE</b> - In case you want to distribute or modify the code</li>
<li><b>CREDITS</b> - (the name says it all)</li>
<li><b>FAQ</b> - Frequently asked questions...and answers!</li>
</ul>
<p>This project is hosted on Source Forge. DOWNLOAD IT <a
href="http://sourceforge.net/projects/html2fpdf" target="_blank">THERE</a>!</p>
This script was written on PHP 4.3.3 (should work on 4.0 and greater)
<br /><br/>
</body>
</html>
<?
// Output-Buffer in variable:
$html=ob_get_contents();
// delete Output-Buffer
ob_end_clean();
$pdf=new HTML2FPDF();
$pdf->AddGBFont('GB','·ÂËÎ_GB2312');
$pdf->AddPage();
$pdf->WriteHTML(iconv("UTF-8","GB2312",$html));
$pdf->Output("tmp.pdf",true);
?>