I am using itext 7 to render HTML templates (Velocity) to PDF, then to PNG (Apache PdfBox), for thermal printer printing.
My template is rendered as :
<html>
<head>
<style>...</style>
</head>
<body>
<div id="container">...</div>
</body>
</html>
My container has a fixed width to 512px. I would like to measure the rendered height of the html, and then render it as a single page PDF with page height = measured height.
But the rendered size is not the expected size. I expect to have a rendered width of 512px, but the layoutResult returns a width of 385 (instead of the expected 512).
Which parameter have I missed ? Thanks.