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().
¸ñÂ÷