Search code examples
javapdfhtml-tableexport-to-pdf

Export html tables with large number of columns to PDF


I need to export html table to PDF in Java. My table has large number of columns. When I export it PDF only few columns are displayed, rest are cut off. Need suggestions on how I can display all the columns. (On the html page I used horizontal scrollbar to handle large number of columns, but no idea what to do on pdf)


Solution

  • I can see 2 solutions :

    • Either you split your huge table into smaller tables that you can display one below the other,

      or

    • You try fitting your large table "as is" onto a larger page size such as A1 or A0 instead of the standard A4 or letter.

      ( See the actual sizes here : http://www.papersizes.org/a-paper-sizes.htm )

      Then when you generate your pdf you should also be able to set a small zoom such as 20%, so that the document opens "zoomed out".