Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8088509

Page-setup settings are ignored when printing WebView

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3 P3
    • tbd
    • 8, 9
    • javafx
    • MacOS 10.10.3, Retina MacBook Pro

      I try to print the content of a WebView with the following code:

          private void handlePrintButtonAction(ActionEvent event) {
              PrinterJob job = PrinterJob.createPrinterJob();
              if (job != null) {
                  Window window = webView.getScene() != null ? webView.getScene().getWindow() : null;
                  if (job.showPageSetupDialog(window)) {
                      if (job.showPrintDialog(window)) {
                          webView.getEngine().print(job);
                          job.endJob();
                      }
                  }
              }
          }

      The page-setup dialog offers the option to define a scale factor at which the page should be printed. This setting is consistently ignored by the JavaFX WebView. When I print the same page via Firefox, which provides exactly the same dialog for setting the scale factor, it works as expected and a scaled version of the page content is printed. I expect JavaFX to do the same.

            prr Philip Race
            dpausjfx Dr. Michael Paus (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Imported: