File: acceptpagebreak.htm

package info (click to toggle)
php-fpdf 1.53.dfsg-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 716 kB
  • ctags: 647
  • sloc: php: 2,257; makefile: 9; sh: 4
file content (69 lines) | stat: -rwxr-xr-x 2,506 bytes parent folder | download | duplicates (3)
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
<!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>
&nbsp;&nbsp;&nbsp;&nbsp;//Move position to a column<BR>
&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;col=$col;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;$x=10+$col*65;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;SetLeftMargin($x);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;SetX($x);<BR>
}<BR>
<BR>
function AcceptPageBreak()<BR>
{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;if($this-&gt;col&lt;2)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//Go to next column<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;SetCol($this-&gt;col+1);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;SetY(10);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return false;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
&nbsp;&nbsp;&nbsp;&nbsp;else<BR>
&nbsp;&nbsp;&nbsp;&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//Go back to first column and issue page break<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;SetCol(0);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return true;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
}<BR>
}<BR>
<BR>
$pdf=new PDF();<BR>
$pdf-&gt;AddPage();<BR>
$pdf-&gt;SetFont('Arial','',12);<BR>
for($i=1;$i&lt;=300;$i++)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;$pdf-&gt;Cell(0,5,&quot;Line $i&quot;,0,1);<BR>
$pdf-&gt;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>