Re: FIle_PDF
| From: | Jorge Guzmán | Date: | Fri, 01 Dec 2006 03:04:33 +0000 |
| Subject: | Re: FIle_PDF | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-25958@lists.php.net to get a copy of this message | ||
Danny Brow <dan <at> fullmotions.com> writes:
>
> Anyone have a working example of the File_PDF class?
>
> Thanks,
> Dan.
>
<?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'); //('archivo', X, Y,
ANC,
ALT, 'tipo') //Archivo de Imagen
$pdf -> image('Mon1.jpg', 19.5, 1, 1.2, 2, 'jpg'); //('archivo', X,
Y, ANC,
ALT, 'tipo') //Archivo de Imagen
$pdf -> image('Con1.jpg', 9.15, 12, 0, 0, 'jpg'); //('archivo', X,
Y, ANC,
ALT, 'tipo') //Archivo de Imagen
$yradcp1 = 0.6;
for($i=0; $i<=10;$i++){
$pdf -> circle(0.6, $yradcp1, 0.25, 'D'); //(X, y, rad, 'DF') D=borde,
F=relleno, DF=relleno y borde
$pdf -> circle(20.9, $yradcp1, 0.25, 'D');
$yradcp1 += 1.25;
}
$pdf -> line(1.2, 0, 1.2, 14); //(X1, Y1, X2, y2)
$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'); //Algun directorio para guardar el archivo
con permisos chmod 777
$pdf -> close();
?>