PDF Generation: Fitting a Table to a Page

I need to export a table with dynamic row count to PDF that should fit one page .

I am currently creating an HTML document by wrapping a table in <div>

and then using CSS zoom

to shrink; the percentage is calculated on a line-by-line basis. This HTML is then converted to PDF via wkhtmltopdf.

I need a better solution because the computation is zoom

not very reliable. Some lines appear above others and also wkhtmltopdf has some rendering issues when using scaling.

I have looked through FOP, iText and some other libraries / tools docs but couldn't find a solution.

Requirement only: it must run on a Linux machine.



source to share

All Articles