Modification d'un PDF existant
Bonjour,
suite à cette discussion...
Citation:
Envoyé par
jreaux62
Ça semble être un jeu d'enfant
Ca ne fait que sembler...
Je suis intéressé car la solution que j'avais avant (un logiciel Adobe) ne fonctionne plus depuis un changement de PC.
Créer un pdf de 0,no pb. Les tutos font ça bien, mais modifier un pdf existant, là je coince.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| <?php
use setasign\Fpdi\Fpdi;
require_once('../fpdf.php'); //j'ai modifié le chemin
require_once('../src_fpdfi/autoload.php'); //j'ai aussi modifié le chemin après avoir récupéré les fichiers à https://www.setasign.com/products/fpdi/downloads/
// initiate FPDI
$pdf = new Fpdi();
// add a page
$pdf->AddPage();
// 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 10,10 with a width of 100 mm
$pdf->useTemplate($tplIdx, 10, 10, 100);
// now write some text above the imported page
$pdf->SetFont('Helvetica');
$pdf->SetTextColor(255, 0, 0);
$pdf->SetXY(30, 30);
$pdf->Write(0, 'This is just a simple text');
$pdf->Output(); |
Citation:
Fatal error: Uncaught Exception: FPDF error: Some data has already been output, can't send PDF file in C:\wamp64\www\pdf\fpdf.php on line 271
Exception: FPDF error: Some data has already been output, can't send PDF file in C:\wamp64\www\pdf\fpdf.php on line 271
et ligne 271 : throw new Exception('FPDF error: '.$msg);