Home » File Formats » File_PDF » Bug #1543
header() and footer() methodes
Details
| Submitted | 2004-06-02 13:40 UTC |
|---|---|
| From | pear at humbapa dot ch |
| Assigned | yunosh |
| Status | Closed |
| Package | File_PDF |
| PHP Version | Irrelevant |
| OS | Linux |
| Roadmaps | (Not assigned) |
Comments
[2004-06-02 13:40 UTC] pear at humbapa dot ch
Description:
------------
I'm trying to use the header() and footer() methodes but somehow it does not work as expected:
class mypdf extends File_PDF
{
function header() {
$this->line(20, 18, 168, 18);
}
}
$pdf = mypdf::factory("P", "mm", "A4");
but like this my header-methode will never be called
I think it has something to do with the factory-methode in the class File_PDF:
function &factory($orientation = 'P', $unit = 'mm', $format = 'A4')
{
...SKIP...
/* Create the PDF object. */
$pdf = &new File_PDF();
...SKIP...
return $pdf;
}
I'm not so familiar with classes and objects, but doesn't this methode return an instance of the File_PDF-class and not an instance of my new mypdf-class?
thanks!
martin luethi
[2006-12-01 03:16 UTC] webmaster at lasdunaschahue dot com dot mx
<?php
require_once("File/PDF.php");
class Boleta extends File_PDF {
function footer() {
$this -> text(10.75, -0.5, 'Pagina '.
$this -> getPageNo().' de {nb}');
}
function header() {
$this -> line(0, 0.5, 21.5, 0.5);
}
}
$dim_pag = array(21.5, 14);
$pdf =
&File_PDF::factory(array('orientation'=>'P','unit'=>'cm',
'format'=>$dim_pag),
('Boleta'));
$pdf -> open();
$pdf -> addpage();
$pdf->setFont('Arial','',7);
$pdf -> image('Oax1.jpg', 1, 1, 2, 2, 'jpg');
$pdf -> image('Mon1.jpg', 19.5, 1, 1.2, 2, 'jpg');
$pdf -> image('Con1.jpg', 9.15, 12, 0, 0, 'jpg');
$yradcp1 = 0.6;
for($i=0; $i<=10;$i++){
$pdf -> circle(0.6, $yradcp1, 0.25, 'D');
$pdf -> circle(20.9, $yradcp1, 0.25, 'D');
$yradcp1 += 1.25;
}
$pdf -> line(1.2, 0, 1.2, 14);
$pdf -> line(20.2, 0, 20.2, 14);
for($i=0; $i<=14; $i++){
$pdf -> text(0, $i, '_'.$i);
}
$texto = "Texto de Prueba para ejecutar el multiCell y
generar varias páginas";
for($i=0; $i<=25;$i++){
$pdf -> multiCell(5, 0.3, $texto, 1, 'J', 0);
}
$pdf -> setDisplayMode('fullpage');
$pdf -> output('ejemplo.pdf');
//$pdf -> save('PDF/ejemplo.pdf');
$pdf -> close();
?>