This is a PHP4 class for generating PDF files on-the-fly without requiring external extensions.
This class is an extension and improvement of the FPDF class by Olivier Plathey (http://www.fpdf.org).
This version contains some changes: [porting to PHP4, support for UTF-8 Unicode, code style and formatting, php documentation (www.phpdoc.org), ISO page formats, minor improvements, image scale factor]
TCPDF project (http://tcpdf.sourceforge.net) is based on the public Domain FPDF class by Olivier Plathey (http://www.fpdf.org).
To add your own TTF fonts please read /fonts/README.TXT
Located in /tcpdf.php (line 88)
This is the class constructor.
It allows to set up the page format, the orientation and the measure unit used in all the methods (except for the font sizes).
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().
This method is called automatically and should not be called directly by the application.
Example:
The method is overriden in an inherited class in order to obtain a 3 column layout:
class PDF extends TCPDF {
var $col=0;
function SetCol($col) {
//Move position to a column
$this->col=$col;
$x=10+$col*65;
$this->SetLeftMargin($x);
$this->SetX($x);
}
function AcceptPageBreak() {
if($this->col<2) {
//Go to next column
$this->SetCol($this->col+1);
$this->SetY(10);
return false;
}
else {
//Go back to first column and issue page break
$this->SetCol(0);
return true;
}
}
}
$pdf=new PDF();
$pdf->Open();
$pdf->AddPage();
$pdf->SetFont('Arial','',12);
for($i=1;$i<=300;$i++) {
$pdf->Cell(0,5,"Line $i",0,1);
}
$pdf->Output();
Imports a TrueType or Type1 font and makes it available. It is necessary to generate a font definition file first with the makefont.php utility. The definition file (and the font file itself when embedding) must be present either in the current directory or in the one indicated by FPDF_FONTPATH if the constant is defined. If it could not be found, the error "Could not include font definition file" is generated.
Support UTF-8 Unicode [Nicola Asuni, 2005-01-02]. Example:
$pdf->AddFont('Comic','I');
// is equivalent to:
$pdf->AddFont('Comic','I','comici.php');