My projects entail creating an HTML form (with PHP) and submitting that form to a tcpdf file using a blank form as background.
Fields are placed into an array, example below:
$Display=array
(
array("field" => $Group, "X" => 176, "Y" => 30),
array("field" => $Name, "X" => 5, "Y" => 37),
array("field" => $SocialSecurity, "X" => 160, "Y" => 37),
etc.
}
Then:
$pdf->AddPage();
Some of these forms are quite long, and it takes some time to figure out the coordinates. I've tried writing a JavaScript routine I can temporarily add to the page to figure the coordinates using a mouse, but I can't seem to find a reasonably workable calculation to convert the mouse coordinates to TCPDF's coordinates. The only alternative I can see is to create a grid and overlay it temporarily over the background form. There must be an easier way. What are TCPDF's units measured in? I can't seem to find that information.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
My projects entail creating an HTML form (with PHP) and submitting that form to a tcpdf file using a blank form as background.
Fields are placed into an array, example below:
$Display=array
(
array("field" => $Group, "X" => 176, "Y" => 30),
array("field" => $Name, "X" => 5, "Y" => 37),
array("field" => $SocialSecurity, "X" => 160, "Y" => 37),
etc.
}
Then:
$pdf->AddPage();
$pdf->setSourceFile('templates/PDF_File.pdf');
$tplIdx = $pdf->importPage(1);
$pdf->useTemplate($tplIdx, 0, 0, 217);
for($i = 0; $i < sizeof($Display2); ++$i)
{
$Xpos = $Display2[$i]["X"];
$Ypos = $Display2[$i]["Y"];
}
$pdf->Output('File1.pdf', 'D');
Some of these forms are quite long, and it takes some time to figure out the coordinates. I've tried writing a JavaScript routine I can temporarily add to the page to figure the coordinates using a mouse, but I can't seem to find a reasonably workable calculation to convert the mouse coordinates to TCPDF's coordinates. The only alternative I can see is to create a grid and overlay it temporarily over the background form. There must be an easier way. What are TCPDF's units measured in? I can't seem to find that information.
The unit is set in TCPDF's constructor as the second argument, valid units are
The default value (if you don't provide one) is millimeters, also see
http://www.tcpdf.org/doc/code/classTCPDF.html#a134232ae3ad1ec186ed45046f94b7755