2009-03-06 03:20:46 +00:00
|
|
|
<!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>
|
|
|
|
<h1>AcceptPageBreak</h1>
|
|
|
|
<code><b>boolean</b> AcceptPageBreak()</code>
|
|
|
|
<h2>Description</h2>
|
|
|
|
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.
|
|
|
|
<h2>Example</h2>
|
|
|
|
The method is overriden in an inherited class in order to obtain a 3 column layout:
|
|
|
|
<div class="doc-source">
|
|
|
|
<pre><code>class PDF extends FPDF
|
|
|
|
{
|
2011-11-03 02:25:38 +00:00
|
|
|
var $col = 0;
|
2009-03-06 03:20:46 +00:00
|
|
|
|
|
|
|
function SetCol($col)
|
|
|
|
{
|
2011-11-03 02:25:38 +00:00
|
|
|
// Move position to a column
|
|
|
|
$this->col = $col;
|
|
|
|
$x = 10+$col*65;
|
2009-03-06 03:20:46 +00:00
|
|
|
$this->SetLeftMargin($x);
|
|
|
|
$this->SetX($x);
|
|
|
|
}
|
|
|
|
|
|
|
|
function AcceptPageBreak()
|
|
|
|
{
|
|
|
|
if($this->col<2)
|
|
|
|
{
|
2011-11-03 02:25:38 +00:00
|
|
|
// Go to next column
|
2009-03-06 03:20:46 +00:00
|
|
|
$this->SetCol($this->col+1);
|
|
|
|
$this->SetY(10);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-11-03 02:25:38 +00:00
|
|
|
// Go back to first column and issue page break
|
2009-03-06 03:20:46 +00:00
|
|
|
$this->SetCol(0);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-03 02:25:38 +00:00
|
|
|
$pdf = new PDF();
|
2009-03-06 03:20:46 +00:00
|
|
|
$pdf->AddPage();
|
|
|
|
$pdf->SetFont('Arial','',12);
|
|
|
|
for($i=1;$i<=300;$i++)
|
|
|
|
$pdf->Cell(0,5,"Line $i",0,1);
|
|
|
|
$pdf->Output();</code></pre>
|
|
|
|
</div>
|
|
|
|
<h2>See also</h2>
|
|
|
|
<a href="setautopagebreak.htm">SetAutoPageBreak()</a>.
|
|
|
|
<hr style="margin-top:1.5em">
|
|
|
|
<div style="text-align:center"><a href="index.htm">Index</a></div>
|
|
|
|
</body>
|
|
|
|
</html>
|