Class "setasign\Fpdi\FpdfTpl" not found when using fpdi and
Résoluzakri-04 Messages postés 21 Date d'inscription Statut Membre Dernière intervention -
- Fpdi.php
- Spybot search and destroy - Télécharger - Antivirus & Antimalwares
- Vb6fr.dll could not be found - Forum Windows
- The realtek network controller was not found ✓ - Forum Pilotes (drivers)
- Fast and furious torrent magnet ✓ - Forum Téléchargement
- Find and mount - Télécharger - Récupération de données
3 réponses
J'ai trouvé la solution en cherchant sur youtube : 1)installer depuis le composer : composer require setasign/fpdi-fpdf 2)Le code : <?php use setasign\Fpdi\Fpdi; require_once('vendor/autoload.php'); $file = 'fichiers_uploades/UN250420191895923066.pdf'; $image = 'QRCodes/CodeQR1.png'; $pdf = new Fpdi(); if(file_exists("./".$file)){ $pagecount = $pdf->setSourceFile($file); }else{ die('Source PDF not found!'); } // Add watermark image to PDF pages for($i=1;$i<=$pagecount;$i++){ $tpl = $pdf->importPage($i); $size = $pdf->getTemplateSize($tpl); $pdf->addPage(); $pdf->useTemplate($tpl, 1, 1, $size['width'], $size['height'], TRUE); //Put the watermark $xxx_final = ($size['width']-60); $yyy_final = ($size['height']-65); $pdf->Image($image, $xxx_final, $yyy_final, 0, 0, 'png'); } // Output PDF with watermark $pdf->Output('F', 'fichiers_generes/UN250420191895923066.pdf');