【发布时间】:2013-10-07 11:48:16
【问题描述】:
我正在使用 TCPDF Vendor 包在 CakePHP 应用程序中生成 PDF 报告。
我必须在生成的 PDF 的每一页上创建页面边框。
我使用this solution 制作页面边框,但只能在生成的 PDF 的第一页上绘制边框。
我正在使用以下代码:
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->AddPage();
$pdf->SetLineStyle( array( 'width' => 15, 'color' => array(0,0,0)));
$pdf->Line(0,0,$pdf->getPageWidth(),0);
$pdf->Line($pdf->getPageWidth(),0,$pdf->getPageWidth(),$pdf->getPageHeight());
$pdf->Line(0,$pdf->getPageHeight(),$pdf->getPageWidth(),$pdf->getPageHeight());
$pdf->Line(0,0,0,$pdf->getPageHeight());
//rest of my code to make proper Html
.....
.....
$pdf->writeHTML($content_html, true, 0, true, 0); //$content_html contains the whole Html which outputs me several PDF pages
ob_clean();
$pdf_status = $pdf->Output($directory_path.$file_name.EXT_PDF, 'F'); // save pdf on the given path
请提出解决方案。任何帮助将不胜感激。
【问题讨论】:
-
从外观上看,您是在第一页上绘制边框,然后编写多页 HTML。你没有告诉它在任何地方写下其余页面的边框。我不相信这是可能的。
-
@MichaelDeMutis,是的,我想在其余页面上也写边框。
标签: php html cakephp pdf tcpdf