I'm having a problem plotting html elements over the image that was made by converting the PDF using ImageMagick.
Once I finished converting the PDF to image, I displayed it on the HTML with the PDF size that I got using the function getTemplateSize() of mPDF hoping that it would render exactly the same as the PDF. But once I write the html element to the PDF using the same position. It's not placed properly.
The PDF size is 215.9mm x 279.4mm which is an A4 size, as I said, I got it using mPDF. I set the image size to 215.9mm x 279.4mm to get an A4 size.
I uploaded a screenshot for reference, left image is the image rendered on HTML with overlayed html elements, right image is the actual PDF that I edited using mPDF to write the same checkbox in place.
Any advices? Please help. Thanks.
Reference: Convert PDF to HTML in PHP similar to DocuSign
PS. Checked if there are hidden margins or paddings while I render the image on HTML, nothing.
// HTML Element over the image from PDF
<div class="singeCheckbox-1" style="position: absolute; top: 74.8mm; left: 13.8mm;">
<input type="checkbox" class="pdf-checkbox" onChange="pdfSingleCheckbox(this)">
</div>
// HTML Element write to PDF
$html = '<div style="position: absolute; top: 74.8mm; left: 13.8mm;">
<input type="checkbox" checked="true" style="font-size: 16px;">
</div>';
Solution: I was right all along, there's just something wrong with how I render my checkbox on the html, because I put a customized div that shows a fake checkbox on html instead of the actual checkbox. That's why the positions are different when rendered on the pdf because the position that I have was the customized checkbox.