JavaFx: webview print with scale 100%

Александр Свиридов ooo_saturn7 at mail.ru
Mon Jun 15 05:53:24 UTC 2015


To print my html page I use the following code:
PrinterJob job =PrinterJob.createPrinterJob();if(job !=null&& job.showPrintDialog(null)){
      webView.getEngine().print(job);
      job.endJob();}
The problem is that webview changes the scale of printing page. For example, when I print this html page in IE with fit to size 100% I get 16.8 cm. When I print in my java application I get 11.4cm. The size in html file I set in pt - my width is 475pt(A4 width=595pt,so 475pt=16.8cm). How to print with webview and to have 100% width and height?


More information about the openjfx-dev mailing list