I am working in LARAVEL 6.8.
I worknig on to generate New PDF which uses existing PDF as a background template. I have tried FPDF & FPDI packages but I couldn't find a way to add data in it. Below is the code which I have tried but this simple code also gives back the empty pdf.
$pdf = new \setasign\Fpdi\Fpdi();
$pdf->AddPage();
$pdf->setSourceFile('existingPDFfile.pdf'); <--- This PDF has a header and footer already in it.
$tplIdx = $pdf->importPage(1);
$pdf->useTemplate($tplIdx, 10, 10, 200);
$pdf->SetFont('Arial');
$pdf->SetTextColor(255,0,0);
$pdf->SetXY(50, 50);
$pdf->Write(0, "Ajay Patel");
$pdf->Output('D','test.pdf', "F");
In further, I need to use this existing PDF as a template and want to add new data in the body of pdf and generate new pdf from it which has a background of this "Template PDF".
I hope i have explained myself.