I am importing a PDF that is required to fill name and email id as such. Problem is currently I am manually positioning it with X and Y axis. How do I avoid this and get the exact position from the PDF? Is there an easier way?
<?php
//
Initialize code
//
require_once('FPDI/autoload.php');
require_once('fpdf/fpdf.php');
require_once('FPDI/Fpdi.php');
$pdf = new \Mpdf\Mpdf();
$pdf->AddPage();
$pdf->setSourceFile('PDF/Sample.pdf');
$tplIdx = $pdf->importPage(1);
$pdf->useTemplate($tplIdx, 0, 0, 297, 420, true);
//Setting the position for the texts
$pdf->WriteText(56.5, 46, "Damien");
$pdf->WriteText(56.5, 66, "damien@testmail.com");
$pdf->Output("Downloads/" . "myPDF.pdf", 'F'); //Save file in directory
?>