簡體   English   中英

使用 fpdf 的新頁面的分頁符

[英]Page break for new page using fpdf

我想使用 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');
     }

    }  

例如:

我聲明$i = 0; 在我的 PDF 的開頭和我在 foreach 中添加的每一行,我都將$i計算$i $i++ 例如,如果您想在x行后使用分頁符,您可以說:

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

以及添加新頁面的功能:

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

我希望這會為您指明正確的方向。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM