AcceptPageBreak

boolean AcceptPageBreak()

설명

어디에서건 페이지 바꿈을 만나게 된다면 메소드가 호출되고 반환값에 의해 줄바꿈이 되거나 그렇지 않게 된다. 기본적으로 구현된 메소드에는 SetAutoPageBreak() 에 의해 선택된 값이 반환된다.
이 메소드는 자동으로 호출되므로, 프로그램에서 직접 호출할 필요는 없다.

예제

이 메소드는 3칼럼 레이아웃을 얻기 위해 상속받은 클래스에서 다음과 같이 오버라이드 될 수도 있습니다.
class PDF extends FPDF
{
var $col=0;

function SetCol($col)
{
    //Move position to a column
    $this->col=$col;
    $x=10+$col*65;
    $this->SetLeftMargin($x);
    $this->SetX($x);
}

function AcceptPageBreak()
{
    if($this->col<2)
    {
        //다음 칼럼으로 이동
        $this->SetCol($this->col+1);
        $this->SetY(10);
        return false;
    }
    else
    {
        //첫칼럼으로 이동후 페이지 변경
        $this->SetCol(0);
        return true;
    }
}
}

$pdf=new PDF();
$pdf->AddPage();
$pdf->SetFont('Arial','',12);
for($i=1;$i<=300;$i++)
    $pdf->Cell(0,5,"Line $i",0,1);
$pdf->Output();

참고

SetAutoPageBreak().
목차