PageOrientation partially ignored?

Tobias Oelgarte tobias.oelgarte at gmail.com
Tue Aug 18 04:01:17 UTC 2020


I just experimented with the JavaFX printing API and I'm confused about 
the results.

If I request to print in landscape format the resulting page is still in 
portrait mode, but rotated by 90 degrees and with mirrored 
borders/margins. Is this intentional or should I file a bug report?

Simplified Example:

Printer printer = Printer.getDefaultPrinter();
PageLayout layout = printer.createPageLayout(Paper.A4, 
PageOrientation.LANDSCAPE, 80, 20, 10, 40);
PrinterJob job = PrinterJob.createPrinterJob(printer);
job.getJobSettings().setPageLayout(layout);
boolean success = job.printPage(someNode);
if (success) {
     job.endJob();
}

What i would expect would be an A4 page in landscape orientation, with a 
top border (long side) of 10, a bottom border of 40, a left border of 80 
and a right border of 20. The content/node will not be rotated.

But what i get is the following. The paper size is A4 as requested. The 
orientation is portrait (not as requested). The top border (long side) 
is 40, the bottom border is 10, the left border is 20, the right border 
is 80. The content/node is rotated by 90 degrees to the left.

My guess is that the orientation is partially ignored, resulting in the 
confusing margins.

-- 
Tobias Oelgarte
Mail: tobias.oelgarte at gmail.com



More information about the openjfx-dev mailing list