acceptpagebreak.htm
2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<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->Open();<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>.
<H6></H6>
<HR>
<DIV ALIGN="CENTER"><A HREF="index.htm">Index</A></DIV>
</BODY>
</HTML>