Forum Bugs

Horizontally Large Html Tables are overflowing in a A4 Page (Portrait) | How to scale-down ?


We are printing HTML in a pdf document that might contain horizontally larger HTML table elements.
The requirement is to fit such tables into the document (A4: portrait) no matter its width.
The expectation would be, even if the table is wider it has to be scaled down or shrink to fit on the page without scaling down the other contents on the page and the scaled-down table should not get pushed to a new page.

So, in short;
‘Scale-down/shrink HTML tables to fit horizontally, on an A4 Page’

There is no mechanism to automatically scale down a single table, you can apply shrink-to-fit to an entire page but not a single element.

You might be able to use a two-pass JavaScript process to measure the overflow in the first pass and apply suitable CSS to shrink the table in the second pass.
thanks for the replay.

Can u pls post some links to try the "two-pass JavaScript process " you mentioned here ?
Here's a description:

In the example provided, the layout process is run two times; the ToC and index are generated after the first pass.