user3829658
user3829658

Reputation: 159

how to print a table in javafx

i had following codes to print a table

public void print(final Node node) {
    Printer printer = Printer.getDefaultPrinter();

    PrinterJob job = PrinterJob.createPrinterJob();
    if (job != null) {
        boolean success = job.printPage(node);
        if (success) {
            job.endJob();
        }
    }
}

on button click

print(table);

but it doesn't print all columns it cuts half of table and print the half table.

I want to print the complete table. Is there any other codes to print a complete table.

Please help me.

Upvotes: 0

Views: 2225

Answers (1)

Georgian
Georgian

Reputation: 8960

Depends on how large your Node (i.e. Table) is at printing time. If you resize your table to all columns, then it will print all of them.

Same thing goes with the snapshot API for Node.

Edit 1: As this article mentions, the table region must fit the printed page.

Upvotes: 1

Related Questions