Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

SOLVED: How to write a tableview in a pdf with Java (with Itext)?

Geoffrey Alleman:

I will try to be as complete as possible.

I want to Write a "tableview" in a pdf with Itext 5.

But i don't find: what is the line to write the tableview in the PDF.

I create the tableview with scenebuilder.

The application is to print a bill, the tableview is the list of the products.

There are my attempts :

private TableView tableProduct;

//Create table products
final ObservableList productSelected = FXCollections.observableArrayList(
new Product("Product name 1",23,23,1.0),
new Product("Product name 2",23,4,11.0),
new Product("Product name 3",45,3,11.0)
Document document = new Document();
try {
PdfWriter.getInstance(document, new FileOutputStream(chemin));;
document.add(tableProduct); //Error
document.add(tableProduct.getItems().toString()); //Error

catch (DocumentException de) {
Logger.getLogger(PDFgenerator.class.getName()).log(Level.SEVERE, null, de);
} catch (IOException ioe) {
} catch (Exception e) {


I'm going to continue to search the solution. if i find, i put it. Thank you for your helps so quick ;)

Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered

This post first appeared on Stack Solved, please read the originial post: here

Share the post

SOLVED: How to write a tableview in a pdf with Java (with Itext)?


Subscribe to Stack Solved

Get updates delivered right to your inbox!

Thank you for your subscription