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 :


@FXML
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)
);
===================================PDF=====================================
Document document = new Document();
try {
PdfWriter.getInstance(document, new FileOutputStream(chemin));

document.open();
document.add(tableProduct); //Error
document.add(tableProduct.getItems().toString()); //Error

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

document.close();

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
HERE


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

×