how to export Table to pdf

Hi there

how to export Table to pdf in vaadin?

Is there any add-one or way?

There’s an add-on for exporting to CSV: https://vaadin.com/directory/component/exporter

Generating a PDF can be done with a library like iText.

Olli Tietäväinen:
There’s an add-on for exporting to CSV: https://vaadin.com/directory/component/exporter

Generating a PDF can be done with a library like iText.

Thanks for your answer.

CSV part is done :

Grid tableGrid = TableView.getTable(i);
                    Anchor anchor1 = new Anchor(new StreamResource("grid.csv", TableView::getInputStream), "Export as CSV");

but for pdf I can’t find anything.

could you show me an example?

I believe iText requires a licence, if for commercial use. Apache PDFBox is fully open source, and very easy to use. [https://pdfbox.apache.org/]
(https://pdfbox.apache.org/)

Yep, PDFBox looks like a good alternative. If you search the internet for “PDFBox tutorial” you’ll find many examples.

I would suggest https://github.com/LibrePDF/OpenPDF that’s a iText 4 fork and is IMHO easier to use than PDFBox.