1

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

?>

enter image description here

Vika
  • 419
  • 1
  • 13
  • You ever figure out something cause I've been searching high and low for a decent GUI type solution as well. – n0nag0n Nov 06 '22 at 05:15

0 Answers0