1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
| <?php
require('connexion.php');
include("phpToPDF.php");
?>
<?php
class PDF extends FPDF
{
// en-tête
function Header()
{
//Police Arial gras 15
$this->SetFont('Arial','B',14);
//Décalage à droite
$this->Cell(80);
//Titre
$this->Cell(30,10,'Mon joli fichier PDF',0,0,'C');
//Saut de ligne
$this->Ln(20);
}
// pied de page
function Footer()
{
//Positionnement à 1,5 cm du bas
$this->SetY(-15);
//Police Arial italique 8
$this->SetFont('Arial','I',8);
//Numéro de page
$this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
}
}
// création du pdf
$pdf=new PDF();
$pdf->SetAuthor('Un grand écrivain');
$pdf->SetTitle('Mon joli fichier');
$pdf->SetSubject('Un exemple de création de fichier PDF');
$pdf->SetCreator('fpdf_cybermonde_org');
$pdf->AliasNBPages();
$pdf->AddPage();
$conn;
$stid = oci_parse($conn, 'SELECT COUNTRY_NAME_EN,COUNTRY_ISO_CODE,COUNTRY_ID FROM COUNTRY ORDER BY COUNTRY_NAME_EN ');
oci_execute($stid);
while (($row = oci_fetch_array($stid, OCI_BOTH)) != false) {
$id = $row["COUNTRY_ID"];
$titre = $row["COUNTRY_NAME_EN"];
$description=$row["COUNTRY_NAME_EN"];
$pdf->SetFont('Arial','B',10);
$pdf->Write(5,$titre);
$pdf->Ln();
// description
$pdf->SetFont('Arial','',10);
$pdf->Write(3,$description);
$pdf->Ln();
$pdf->Ln();
// sortie du fichier
$pdf->Output('monfichier1.pdf', 'I');
}
?> |
Partager