Print option for a layout

Hi All,

I am developing a reporting application using Vaadin. As part of this it is very vital that we have a print option provided. One of my screens will diplay various charts and tables along with diffrent components which help in creating the charts and tables.
When the user clicks on the print button, we want an option where only the charts and tables are pritable in a pdf.

Can someone please let me know if there is any option available in Vaadin7 to achieve this ?

Hi,

That isn’t really a Vaadin issue, but more an application topic. It’s generally a bad idea to print Vaadin UIs, as most components have user interaction elements, such as scrollbars and buttons. There’s at least the following basic ways to print:

  • Print the exactly same UI
  • Print the same UI, but change its appearance with @media print {} rules in CSS.
  • Open a special UI for printing
    as is done here
    , using only print-friendly components.
  • Generate HTML page to print (no Vaadin components)

  • Generate PDF report to print
    (RECOMMENDED)

There’s many free and commercial Java PDF tools and report generators to choose from, such as Apache FOP (very low-level), iText, etc.

Thanks a lot for your response Marko. I am more interested in the last option
I will definitely try the these and post back.