setPrintHeader(false); //不要頁首 $pdf->setPrintFooter(false); //不要頁尾 // $pdf->SetAutoPageBreak(true, PDF_MARGIN_BOTTOM); //設定自動分頁 $pdf->setFontSubsetting(true); //產生字型子集(有用到的字才放到文件中) $pdf->SetMargins(15, 15); //設定頁面邊界, $pdf->AddPage(); //新增頁面,一定要有,否則內容出不來 $pdf->SetFont('droidsansfallback', '', 24, '', true); //設定字型 $pdf->Cell(180, 12, '巷談集文章列表', 0, 1, 'C', 0); $myts = MyTextSanitizer::getInstance(); $tbl = $xoopsDB->prefix('snews'); $sql = "SELECT * FROM `$tbl` ORDER BY create_time DESC"; $result = $xoopsDB->query($sql) or web_error($sql); // $pdf->Cell($w, $h = 0, $txt = '', $border = 0, $ln = 0, $align = '', $fill = 0, $link = nil, $stretch = 0, $ignore_min_height = false, $calign = 'T', $valign = 'M') //$pdf->MultiCell( $w, $h, $txt, $border = 0, $align = 'J', $fill = false, $ln = 1, $x = '', $y = '', $reseth = true, $stretch = 0, $ishtml = false, $autopadding = true, $maxh = 0, $valign = 'T', $fitcell = false ); $pdf->SetFont('droidsansfallback', '', 12, '', true); //設定字型 $height=10; while($snews = $xoopsDB->fetchArray($result)){ $title = $myts->htmlSpecialChars($snews['title']); $username = $myts->htmlSpecialChars($snews['username']); // $count=strlen($title); // $l=ceil($count/60); // if($l>1){ // $height=$h+$l*4; // }else{ // $height=$h; // } $pdf->MultiCell( 130, $height, $title, 1, 'L', false, 0, '', '', false, 0, false, false, $height, 'M', true); $pdf->MultiCell( 28, $height, $username, 1, 'C', false, 0, '', '', false, 0, false, false, $height, 'M', true); $pdf->MultiCell( 22, $height, $snews['update_time'], 1, 'C', false, 1, '', '', false, 0, false, false, $height, 'M', true); // $pdf->Cell(50, $height, $username, 1, 0,'C',0,'',1); // $pdf->Cell(36, $height, $snews['update_time'], 1, 1,'C',0,'',1); } $pdf->Image('images/aa.png', 180, 250, 20, 20, 'png'); $pdf->SetXY(120, 255); $pdf->SetFont('droidsansfallback', '', 16, '', true); //設定字型 $pdf->Cell(20, 10, '簽名:', 0, 0); $pdf->Cell(50, 10, '', 'B', 0, 0); //PDF內容設定 $pdf->Output('snews.pdf', 'I'); ```
進階搜尋
554人線上 (211人在瀏覽線上書籍)
會員: 0
訪客: 554