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
| <?php
use setasign\Fpdi\Fpdi;
require_once('../fpdf.php');
require_once('../src_fpdfi/autoload.php');
// initiate FPDI
$pdf = new Fpdi();
// add a page
$pdf->AddPage();
// PDF A IMPORTER
// set the source file
$pdf->setSourceFile('un_pdf_a_moi.pdf');
// import page 1
$tplIdx = $pdf->importPage(1);
// use the imported page and place it at position 0 0 with a width of 210 mm
$pdf->useTemplate($tplIdx, 0, 0, 210); // position : 0, 0, largeur 210 mm (format A4)
// SIGNATURE A IMPORTER (PDF)
/*$pdf->setSourceFile('un_pdf_a_moi.pdf');
// import page 2
$tplIdx = $pdf->importPage(1);
$pdf->useTemplate($tplIdx, 150, 210, 50); // position : 150, 210, largeur 50 mm (A ADAPTER)
*/
// TEXTE
// now write some text above the imported page
$pdf->SetFont('Helvetica');
$pdf->SetTextColor(255, 0, 0);
$pdf->SetXY(150, 260);
$pdf->Write(0, 'This is just a simple text');
$pdf->Output();
?> |
Partager