21,887
社区成员
发帖
与我相关
我的任务
分享
<div style="font-weight: bold;font-size:14;"> 如贵方需要缴纳,请于<b style="text-decoration:underline;font-weight: bold;">{$date}</b>之前,将该款项转至我司专用来缴纳结果的帐号,同时注明数据号及用途为结果。若贵方指示不委托我方代缴或逾期未收到贵方指示的,我们将默认该<b style="text-decoration:underline;font-weight: bold;">数据贵方不维持</b>,并将该数据作结案处理,即就该案,<b style="text-decoration:underline;font-weight: bold;">贵方与我司委托关系结束;我方将不再有义务转达数据局的通知,请自行监控后续结果时限</b>。另,若贵方未能在指定期限内指示我司,或在超过我司指定期限后付款,则根据数据法规定,<b style="text-decoration:underline;font-weight: bold;">会产生滞纳金</b>,请知悉!</div>
当我去掉div中的其他标签时显示正常,在div标签中加入任何标签都会让中文换行,下面是php代码, $pdf = new \TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Nicola Asuni');
$pdf->SetTitle($title);
$pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
//echo PDF_HEADER_LOGO;exit;
// set default header data
//$pdf->SetHeaderData(PDF_HEADER_LOGO, 180);
// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP+13, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__).'/lang/zho.php')) {
require_once(dirname(__FILE__).'/lang/zho.php');
$pdf->setLanguageArray($l);
}
// ---------------------------------------------------------
// set font
$pdf->SetFont('stsongstdlight', '', 10);
// add a page
$pdf->AddPage();
// $yz="Public/Plus/tcpdf/examples/images/zhang.png";
//$yz_html = '<img src="' . $yz . '" />';
//$footer_image_file = 'Public/Plus/tcpdf/examples/images/footer.png';
// $footer_logo_html = '<img src="' . $footer_image_file . '" />';
//$pdf->serializeTCPDFtagParameters($data);
// writeHTML($html, $ln=true, $fill=false, $reseth=false, $cell=false, $align='')
// writeHTMLCell($w, $h, $x, $y, $html='', $border=0, $ln=0, $fill=0, $reseth=true, $align='', $autopadding=true)
// create some HTML content
//print_r($html);exit;
// output the HTML content
$pdf->writeHTML($html, true, false, true, false, '');
$height = $pdf->getY();
// $pdf->writeHTMLCell(50, 1, 130, $height-35, $yz_html, 0, 1, false, true, 'L', false);
//$pdf->writeHTMLCell(180, 1, 15, $height+16, $footer_logo_html, 0, 1, false, true, 'L', false);
//$footer_image_file = 'Public/Plus/tcpdf/000002.jpg';
//$footer_logo_html = '<img style="border:1px solid #ccc" src="' . $footer_image_file . '" />';
//$pdf->writeHTMLCell(200, 1, 15, $height, $footer_logo_html, 0, 1, false, true, 'L', false);
//Close and output PDF document
$pdf->Output('example_006.pdf', 'I');