Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poor printing quality #379

Ciruman opened this issue Feb 15, 2019 · 3 comments


Copy link

commented Feb 15, 2019

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). This is related to the following ticket:

We found a non-acceptable workarround in the Javafx code:

We added in J2DPrinterJob.printNode the following code:
((com.sun.javafx.geom.transform.Affine2D)ppg.getTransformNoClone()).scale(1.1, 1.1);
And looks like this:

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

The difference is huge in the javafx controls.

Could someone help us about it?

Source code to reproduce the problem:

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();
        boolean success = job.printPage(node);
        if (success) {

    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));;


This comment has been minimized.

Copy link

commented Feb 15, 2019

javafx print comparation

Left side you see the printing from javafx (blurry edges) and on the right side you see the sharp printing with the workaround applied.


This comment has been minimized.

Copy link
Contributor Author

commented Feb 18, 2019

Of course instead of using:
((com.sun.javafx.geom.transform.Affine2D)ppg.getTransformNoClone()).scale(1.0001, 1.0001); could be used: ppg.scale(1.0001, 1.0001); But the thing is how is the best way to flag it as "durty" during the printing rendering. The screenshots @streifi added are from the same JavaFX application printed to two PDFs using Mac. In Windows the result should be the same(not tested).


This comment has been minimized.

Copy link
Contributor Author

commented May 6, 2019

Here it is the Issue:

Does anybody know how could it be fixed? Any hints are welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
1 participant
You can’t perform that action at this time.