PDFGeneration for vaadin

Hello All,

Is their any way to convert vaadin UI to pdf for example into image and then into pdf ? If any one has done that before please reply.

Regards
sachin

There are several ways to generate a PDF document in a Vaadin application. This topic has been discussed earlier for example
in this thread
.

Basic solutions:


  1. Do proper PDF export.
    Printing the screen to PDF will look like you printed the screen to PDF. Proper PDF export can use proper paging, etc. See Knowledge Base
    #291: How do I generate a PDF file?
    (Pro Account required).
  2. Dump the screen to HTML using the
    ScreenDump
    add-on and do HTML->PDF conversion on the server-side using some conversion tool. See Knowledge Base
    #303: How do I get the HTML code of the page?
    . Be warned that the HTML->PDF conversion may have severe styling issues.
  3. Do as you suggested, take an image screenshot using a screenshot tool, such as
    Screenshot
    or
    JS Screenshot
    add-on, and convert it to PDF on the server-side. This is probably the worst solution as you can never have a PDF document bigger than your screen, but can work in simple cases.

PDF Export generate a pdf from de UI component,

https://vaadin.com/directory#addon/pdfexport

Hi Marko:

On proposed solution N 1: Do Proper PDF Export, does it explains how to print a Vaadin layout and all of its components (text, tables, html, charts, etc), sending it to a pdf preview, hopefully getting exactly what I see in the screen (for that specific layout)? Is this possible? even as a screenshot of that layout…

thanks!!

Hi all,

the PDF Export does not support Vaadin 7, is there an alternative addon that one can use or proper titorial how to implement PDF export of the UI? We have a dashboard with several charts and we would like to be able to print them as pdf.

Thank you in advance.

Hi,

Don know exactly your requirements, but how about just printing the page into PDF? If your end users are using Windows, there are free PDF printer drivers available. Macs and modern linuxe machines print PDFs be default.

Other solutions:

  • Use
    PhantomJS
    to render the page and export it to PDF
  • Export individual charts into SVG/PDF (I assume you are using Vaadin Charts), then compose them into one using some of the many Java libraries that can handle PDF files (e.g. iText). This way you can totally customize the output and optimize it for printing.

cheers,
matti

Hi,
One of my requirements is to be able to print charts&tables on a page. Let’s visualize it: you have a 2x2 grid where on grid[0]
[0]
= chart 1, grid [0]
[1]
table, grid[1]
[0]
= chart 2, grid[1]
[1]
= table 2. I know I can use itext or other ( like pdfbox for instance ) to compose a pdf document and send it to print, but I don’t know how I can get the table to be able to print it out…
Any advice here ?

PDF Generation Help Require?

I would recommend to check https://zetpdf.com/
library