Bonjour les dev !
Aider moi à résoudre cette erreur qui affiche au niveau du controller : Unable to find PDF file header.
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use App\PDF;
class TestPdfController extends AbstractController
{
#[Route('/test/pdf', name: 'test_pdf')]
public function index()
{
$pdf = new PDF();
// // set the source file
$pageCount = $pdf->setSourceFile('../src/PDF.php');
$pdf->AliasNbPages();
for ($i = 1; $i <= $pageCount; $i++) {
//import a page then get the id and will be used in the template
$tplId = $pdf->importPage($i);
//create a page
$pdf->AddPage();
//use the template of the imporated page
$pdf->useTemplate($tplId);
}
$pdf->Output();
}
}
Partager