fpdf中的FPDF分页符

问题描述:

我正在使用PHP和FPDF生成包含项目列表的PDF。我的问题是,项目不会进入第二或第三页。fpdf中的FPDF分页符

我想在pdf的第二页打印下一个数据块。 有人请帮助我。我已经使用setautopage break()但不工作。
请帮助!

 <?php 

     require('fpdf.php'); 

     class PDF extends FPDF { 

      function Header() { 

       $this->SetFont('Arial','B',10);  
       $this->Rect(50,30,100,30,'F'); 
       $this->Text(80,45,"3D"); 
       $this->SetXY(20,20); 
       $this->Cell(30,10,'A',1,0,'L');    
       $this->SetXY(80,20); 
       $this->Cell(30,10,'B',1,0,'L');           
       $this->SetXY(80,60); 
       $this->Cell(30,10,'C',1,1,'L');    
       $this->SetXY(150,60); 
       $this->Cell(30,10,'D',1,1,'L');    
      } 

      function Footer() { 
       $this->SetY(-12); 
       $this->Cell(169,20,'Page '.$this->PageNo().'/{nb}',0,0,'C'); 
      } 

      $pdf=new PDF(); 
      $pdf->AddPage(); 
      $pdf->SetFont('Arial','B',16); 
      $pdf->AliasNbPages(); 
      $pdf->Output(); 
+0

哪里是你的产品清单?你能提供一些代码吗? – 2017-12-07 10:50:24

您将需要使用GetYAddpage用于这一目的。

Use GetY to get the current position, subtract it from the height of your document. If that is less than 6x (you have 6 rows) your multicell height, then force a page break by using AddPage.

看到一个详细的解答here

+0

其工作。但它会在第2页上粘贴相同的数据 – 2014-09-25 04:56:57