fpdf中的FPDF分页符

时间:2014-09-24 09:25:11

标签: php fpdf

我使用PHP和FPDF生成带有项目列表的PDF。我的问题是,项目不会进入第二页或第三页。

我想在pdf的第2页打印下一个数据块。      有人请帮帮我。我使用过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();

1 个答案:

答案 0 :(得分:2)

为此,您需要使用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