【问题标题】:Page break for new page using fpdf使用 fpdf 的新页面的分页符
【发布时间】:2014-12-19 03:26:04
【问题描述】:

我想使用 fpdf 创建第二个页面。代码如下。在指定区域的代码中我想开始新页面。这里的 pdf 类是从 fpdf 扩展的。

class PDF extends FPDF
 {

function header{
$this->Ln(20);
     $this->SetFont('Times','',10);
     $this->Cell(0,10,'Kondotty');
     $this->Ln(10);
     $this->SetFont('Times','',10);
     $this->Cell(80,0,'07/10/2014');


    $this->Cell(60,0,'Seal');
    $this->Cell(0,0,'Head of Institution');


//END FIRST PAGE

// STARTING SECOND PAGE




    $this->Ln(10);

    $this->Cell(27);
     $this->Cell(0,10,'Her conduct and character were found ...................................... during that period.');

     $this->Ln(20);
     $this->SetFont('Times','',10);
     $this->Cell(0,10,'Kondotty');
     $this->Ln(10);
     $this->SetFont('Times','',10);
     $this->Cell(80,0,'07/10/2014');
     }

    }  

【问题讨论】:

    标签: php pdf fpdf


    【解决方案1】:

    例如:

    我在我的 PDF 开头声明了$i = 0;,对于我在 foreach 中添加的每一行,我都将$i 视为$i++。 例如,如果你想在 x 行之后分页,你可以说:

    if($i%30==0 && $i!=0) {
       $this->addPage();
    }
    

    还有一个添加新页面的功能:

    private function addPage()
    {
       $this->page = $this->pdf->newPage('A4');
    

    我希望这将为您指明正确的方向。

    【讨论】:

    • $this->pdf->newPage('A4');在这个pdf->指什么?
    • 我的意思是pdf这个词是一个对象?
    • 是的,在我的例子中是 $this->pdf = new \Zend_Pdf();
    猜你喜欢
    • 2014-11-18
    • 1970-01-01
    • 1970-01-01
    • 2013-12-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-05
    • 1970-01-01
    相关资源
    最近更新 更多