Using co-ordinates in XML generated by poppler to build an email template

198 Views Asked by At

Generated a 72 dpi image and XML with zoom as 1 from this PDF.

Although the DPI was 72, to be able to make the conversion of co-ordinates in the XML to pixel possible had to iteratively tweak the DPI using this sheet. 90.5 seems to work well. However, this does not look like the proper way to do it.

Command to generate XML: pdftohtml -xml -zoom 1 -fontfullname -s -c input.pdf output

Command to generate Image: pdftoppm -jpeg -r 72 input.pdf output

Note: 72 dpi was used when generating the image because in 72 dpi the image being output was of similar dimensions to the PDF and the XML output.

This conversion is essential because this will allow the building of the HTML. I am aware that poppler itself can generate the HTML, however, since the generated HTML needs to be made email compatible the XML is being used to build the HTML from scratch.

In what ways can the conversion of the co-ordinates in the XML to PDF be done more reliably?

0

There are 0 best solutions below