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

Poor printing quality

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • jfx11
    • javafx
    • x86
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      any/all

      A DESCRIPTION OF THE PROBLEM :
      We are trying to print a JavaFX Node with a good resolution and we found out that the JavaFX prints with a poor resolution(in Mac and Windows).
      More information:
      https://github.com/javafxports/openjdk-jfx/issues/379

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      By printing the current scene/JavaFX node using the provided JavaFX functionality(PrinterJob)

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Good printing quality
      ACTUAL -
      Poor quality

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.print.PrinterJob;
      import javafx.scene.Node;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.layout.HBox;
      import javafx.stage.Stage;

      public class PrintTest extends Application {

          public static void print(final Node node) {
              PrinterJob job = PrinterJob.createPrinterJob();
              job.showPrintDialog(node.getScene().getWindow());
              boolean success = job.printPage(node);
              if (success) {
                  job.endJob();
              }
          }

          @Override
          public void start(Stage primaryStage) throws Exception {
              Button print = new Button("Print");
              HBox hBox = new HBox(print);
              print.setOnAction(event -> PrintTest.print(hBox));
              primaryStage.setScene(new Scene(hBox));
              primaryStage.show();
          }

      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      private void printNode(Node node, Graphics g, int w, int h) {
                  PrismPrintGraphics ppg =
                          new PrismPrintGraphics((Graphics2D) g, w, h);
      //++++++++++++START
      ((com.sun.javafx.geom.transform.Affine2D)ppg.getTransformNoClone()).scale(1.0001, 1.0001);
      //++++++++++++END
                  NGNode pgNode = node.impl_getPeer();
                  boolean errored = false;

      FREQUENCY : always


            prr Philip Race
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: