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
|
// create new PDF document
class MYPDF extends TCPDF
{
public function Header() {
$headerData = $this->getHeaderData();
$this->SetFont('times', '', 10);
$this->writeHTML($headerData['string']);
}
public function Footer()
{
// Position at 15 mm from bottom
$this->SetY(-15);
// Set font
$this->SetFont('helvetica', 'I', 8);
// Page number
$this->Cell(0, 10, 'Page '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M');
}
public function LoadData() {
// Read file lines
$require_once('vegetaux_Facture.php');
$objVeg = new vetegauxFacture;
$items = $objVeg->gelAllItems();
return $data;
}
}
$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
...
$fichier = $nomDocument.'.pdf';
$pdfFile = $pdf->Output($fichier, 'S');
...
$mail->addStringAttachment($pdfFile, $fichier);
... |
Partager