Esempio n. 1
0
        "",//如果要直接清除不安全的标签,这里可以留空  
        "",
   );  
  $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);
$strContent.=uhtml($msg);
//$strContent="测试";
$pdf->WriteHTML(iconv("UTF-8","GB2312",$strContent));
ob_clean();
$pdf->Output("tmp.pdf",true);
//print $strContent;
//echo "PDF file is generated successfully!";
?>
Esempio n. 2
0
/**
 * [guolv 前端过滤非法字符]
 * @param  [type] $data [description]
 * @return [type]       [description]
 */
function guolv($data)
{
    foreach ($data as $key => $value) {
        if (is_array($value)) {
            guolv($value);
        } else {
            $data[$key] = uhtml($value);
        }
    }
    return $data;
}
Esempio n. 3
0
<?php

$filename = iconv('UTF-8', 'gb2312', $_GET['filename']);
header("Content-Type: application/vnd.ms-word;charset=gb2312");
header("Content-Disposition:filename={$filename}.doc");
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Transfer-Encoding: binary ");
$msg = $_POST['userdefine'];
$msg = urldecode($msg);
$msg = uhtml($msg);
$msg = iconv('UTF-8', 'gb2312', $msg);
$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=TableData", "bgcolor=#FFFFFF", $msg);
$msg = str_replace("class=TableControl", "bgcolor=#FFFFFF", $msg);
$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=\"TableData\"", "bgcolor=#FFFFFF", $msg);
$msg = str_replace("noWrap", "", $msg);
$msg = str_replace("></TD>", ">&nbsp;</TD>", $msg);
$msg = str_replace("TABLE>&nbsp;</TD>", "TABLE></TD>", $msg);
$msg = str_replace("width=\"65%\"", "width=\"100%\"", $msg);
$msg = str_replace("width=\"80%\"", "width=\"100%\"", $msg);
$msg = str_replace("width=\"85%\"", "width=\"100%\"", $msg);