JavaFX - printing content from webview adding page number

55 views
Skip to first unread message

in...@area2000.it

unread,
Nov 12, 2015, 8:18:33 AM11/12/15
to javafx
Hi guys,
i need help about printing some content loaded in a webview and at the same time getting the possibility to add the classic page number on footer like "Page x of y".
I searched on the web without find nothing.
Actually my code consists of the follow source:

public void print(final javafx.scene.Node node) { 
        
        Printer printer = Printer.getDefaultPrinter(); 
        
        PrinterJob job = PrinterJob.createPrinterJob(printer); 
        job.getJobSettings().setPageLayout(pageLayout); 
        
        if (job != null) { 
            Window window = webviewDocument.getScene() != null ? webviewDocument.getScene().getWindow() : null; 
            
                if (job.showPrintDialog(window)) { 
                    webviewDocument.getEngine().print(job); 
                    job.endJob(); 
                } 
            
        } 
    }

Any idea to do that? Someone can help me?
Thanx in advance
Reply all
Reply to author
Forward
0 new messages