source: trunk/client/inc/hpdf/_fpdf/doc/acceptpagebreak.htm@ 2

Last change on this file since 2 was 2, checked in by root, 15 years ago

importo il progetto

File size: 1.6 KB
Line 
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html>
3<head>
4<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
5<title>AcceptPageBreak</title>
6<link type="text/css" rel="stylesheet" href="../fpdf.css">
7</head>
8<body>
9<h1>AcceptPageBreak</h1>
10<code><b>boolean</b> AcceptPageBreak()</code>
11<h2>Description</h2>
12Whenever a page break condition is met, the method is called, and the break is issued or not
13depending on the returned value. The default implementation returns a value according to the
14mode selected by SetAutoPageBreak().
15<br>
16This method is called automatically and should not be called directly by the application.
17<h2>Example</h2>
18The method is overriden in an inherited class in order to obtain a 3 column layout:
19<div class="doc-source">
20<pre><code>class PDF extends FPDF
21{
22var $col=0;
23
24function SetCol($col)
25{
26 //Move position to a column
27 $this-&gt;col=$col;
28 $x=10+$col*65;
29 $this-&gt;SetLeftMargin($x);
30 $this-&gt;SetX($x);
31}
32
33function AcceptPageBreak()
34{
35 if($this-&gt;col&lt;2)
36 {
37 //Go to next column
38 $this-&gt;SetCol($this-&gt;col+1);
39 $this-&gt;SetY(10);
40 return false;
41 }
42 else
43 {
44 //Go back to first column and issue page break
45 $this-&gt;SetCol(0);
46 return true;
47 }
48}
49}
50
51$pdf=new PDF();
52$pdf-&gt;AddPage();
53$pdf-&gt;SetFont('Arial','',12);
54for($i=1;$i&lt;=300;$i++)
55 $pdf-&gt;Cell(0,5,&quot;Line $i&quot;,0,1);
56$pdf-&gt;Output();</code></pre>
57</div>
58<h2>See also</h2>
59<a href="setautopagebreak.htm">SetAutoPageBreak()</a>.
60<hr style="margin-top:1.5em">
61<div style="text-align:center"><a href="index.htm">Index</a></div>
62</body>
63</html>
Note: See TracBrowser for help on using the repository browser.