我使用$pdf->SetAutoPageBreak(true);
在多个页面上自动中断长输出,但我有一些样式,我想应用于自动创建的页面:
// HEADER ------------------------------------------------------------------
$pdf->SetTextColor( $headerColour[0], $headerColour[1], $headerColour[2] );
$pdf->SetFont( 'Arial', '', 17 );
$pdf->Cell( 0, 15, $reportName, 0, 0, 'C' );
$pdf->Ln( 16 );
$pdf->SetLineWidth(7);
$pdf->SetDrawColor($col_r, $col_g, $col_b);
$pdf->Line(0, 0, 0, 300);
$pdf->SetLineWidth(0.5);
$pdf->Line(20, 26, 210-20, 26);
$pdf->SetTextColor( 0,0,0 );
$pdf->SetFont( 'Arial', 'B', 24 );
$pdf->Cell( 0, 15, 'Results', 0, 0, 'C' );
$pdf->Line(20, 40, 210-20, 40);
$pdf->Ln( 16 );
$pdf->Write( 6, $file ); // This is about 3 pages long worth of text
这将在页面顶部添加一个标题样式的块,并在页面左侧一直向下添加边框。当数据太大时,如何在每个页面上复制此操作?
您可以创建扩展类来自动创建标题。有关其他示例的更多信息,请查看http://www.fpdf.org/en/tutorial/tuto2.htm或FPDF教程中的示例。