1 | <HTML> |
---|
2 | <HEAD> |
---|
3 | <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> |
---|
4 | <TITLE>AcceptPageBreak</TITLE> |
---|
5 | <LINK TYPE="text/css" REL="stylesheet" HREF="../fpdf.css"> |
---|
6 | </HEAD> |
---|
7 | <BODY> |
---|
8 | <H2>AcceptPageBreak</H2> |
---|
9 | <TT><B>boolean</B> AcceptPageBreak()</TT> |
---|
10 | <H4 CLASS='st'>Version</H4> |
---|
11 | 1.4 |
---|
12 | <H4 CLASS='st'>Description</H4> |
---|
13 | Whenever a page break condition is met, the method is called, and the break is issued or not |
---|
14 | depending on the returned value. The default implementation returns a value according to the |
---|
15 | mode selected by SetAutoPageBreak(). |
---|
16 | <BR> |
---|
17 | This method is called automatically and should not be called directly by the application. |
---|
18 | <H4 CLASS='st'>Example</H4> |
---|
19 | The method is overriden in an inherited class in order to obtain a 3 column layout: |
---|
20 | <BR> |
---|
21 | <BR> |
---|
22 | <TABLE WIDTH="100%" BGCOLOR="#E0E0E0"><TR><TD> |
---|
23 | <TT> |
---|
24 | class PDF extends FPDF<BR> |
---|
25 | {<BR> |
---|
26 | var $col=0;<BR> |
---|
27 | <BR> |
---|
28 | function SetCol($col)<BR> |
---|
29 | {<BR> |
---|
30 | //Move position to a column<BR> |
---|
31 | $this->col=$col;<BR> |
---|
32 | $x=10+$col*65;<BR> |
---|
33 | $this->SetLeftMargin($x);<BR> |
---|
34 | $this->SetX($x);<BR> |
---|
35 | }<BR> |
---|
36 | <BR> |
---|
37 | function AcceptPageBreak()<BR> |
---|
38 | {<BR> |
---|
39 | if($this->col<2)<BR> |
---|
40 | {<BR> |
---|
41 | //Go to next column<BR> |
---|
42 | $this->SetCol($this->col+1);<BR> |
---|
43 | $this->SetY(10);<BR> |
---|
44 | return false;<BR> |
---|
45 | }<BR> |
---|
46 | else<BR> |
---|
47 | {<BR> |
---|
48 | //Go back to first column and issue page break<BR> |
---|
49 | $this->SetCol(0);<BR> |
---|
50 | return true;<BR> |
---|
51 | }<BR> |
---|
52 | }<BR> |
---|
53 | }<BR> |
---|
54 | <BR> |
---|
55 | $pdf=new PDF();<BR> |
---|
56 | $pdf->Open();<BR> |
---|
57 | $pdf->AddPage();<BR> |
---|
58 | $pdf->SetFont('Arial','',12);<BR> |
---|
59 | for($i=1;$i<=300;$i++)<BR> |
---|
60 | $pdf->Cell(0,5,"Line $i",0,1);<BR> |
---|
61 | $pdf->Output(); |
---|
62 | </TT> |
---|
63 | </TD></TR></TABLE><BR> |
---|
64 | <H4 CLASS='st'>See also</H4> |
---|
65 | <A HREF="setautopagebreak.htm">SetAutoPageBreak()</A>. |
---|
66 | <H6></H6> |
---|
67 | <HR> |
---|
68 | <DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV> |
---|
69 | </BODY> |
---|
70 | </HTML> |
---|