带有页面大小检测的itext 7 html到pdf(itext 7 html to pdf with page size detection)
我使用itext 7将HTML模板(Velocity)呈现为PDF,然后呈现为PNG(Apache PdfBox),用于热敏打印机打印。
我的模板呈现为:
我的容器的固定宽度为512px。 我想测量HTML的渲染高度,然后将其渲染为页面高度为测量高度的单页PDF。
但渲染的大小不是预期的大小。 我期望有一个512px的渲染宽度,但layoutResult返回宽度385(而不是预期的512)。
我错过了哪个参数? 谢谢。
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 :
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 o