doutou3725 2016-07-02 18:03
浏览 74

FPDF在自动分页页面上放置标题+样式

I'm using $pdf->SetAutoPageBreak(true); to auto break long outputs over multiple pages but I have some styling that I would like to apply to the auto-created pages:

// 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

This adds a header-style block to the top of the page as well as a border on the left hand side all the way down the page. How can I replicate this on each page when the data is too big?

  • 写回答

1条回答 默认 最新

  • dongtuji0992 2016-07-12 03:15
    关注

    You can create extend class to automatically create the header. Please check the example at http://www.fpdf.org/en/tutorial/tuto2.htm OR FPDF Tutorial for more information for the others sample.

    评论

报告相同问题?

悬赏问题

  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100