123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
- <HTML>
- <HEAD>
- <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
- <TITLE>AcceptPageBreak</TITLE>
- <LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css">
- </HEAD>
- <BODY>
- <H2>AcceptPageBreak</H2>
- <TT><B>boolean</B> AcceptPageBreak()</TT>
- <H4 CLASS='st'>Version</H4>
- 1.4
- <H4 CLASS='st'>Description</H4>
- Whenever a page break condition is met, the method is called, and the break is issued or not
- depending on the returned value. The default implementation returns a value according to the
- mode selected by SetAutoPageBreak().
- <BR>
- This method is called automatically and should not be called directly by the application.
- <H4 CLASS='st'>Example</H4>
- The method is overriden in an inherited class in order to obtain a 3 column layout:
- <BR>
- <BR>
- <TABLE WIDTH="100%" BGCOLOR="#E0E0E0"><TR><TD>
- <TT>
- class PDF extends FPDF<BR>
- {<BR>
- var $col=0;<BR>
- <BR>
- function SetCol($col)<BR>
- {<BR>
- //Move position to a column<BR>
- $this->col=$col;<BR>
- $x=10+$col*65;<BR>
- $this->SetLeftMargin($x);<BR>
- $this->SetX($x);<BR>
- }<BR>
- <BR>
- function AcceptPageBreak()<BR>
- {<BR>
- if($this->col<2)<BR>
- {<BR>
- //Go to next column<BR>
- $this->SetCol($this->col+1);<BR>
- $this->SetY(10);<BR>
- return false;<BR>
- }<BR>
- else<BR>
- {<BR>
- //Go back to first column and issue page break<BR>
- $this->SetCol(0);<BR>
- return true;<BR>
- }<BR>
- }<BR>
- }<BR>
- <BR>
- $pdf=new PDF();<BR>
- $pdf->AddPage();<BR>
- $pdf->SetFont('Arial','',12);<BR>
- for($i=1;$i<=300;$i++)<BR>
- $pdf->Cell(0,5,"Line $i",0,1);<BR>
- $pdf->Output();
- </TT>
- </TD></TR></TABLE><BR>
- <H4 CLASS='st'>See also</H4>
- <A HREF="setautopagebreak.htm">SetAutoPageBreak()</A>.
- <HR STYLE="margin-top:1.2em">
- <DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV>
- </BODY>
- </HTML>
|