I used the following printers together with JavaFX (versions 14.0.2.1 and 16-ea+1):

- cups-pdf under Ubuntu 18.04 (supports A4, all orientations, down to 0 margins)
- PDF24 under Windows 7 (supports A4, all orientations, down to 0 margins)
- Kyocera FS 2020DN under Windows 7 (supports A4, all orientations, margins adjusted to match printer)

All show exactly the same (wrong) result.

Tobias Oelgarte
Mail: tobias.oelga...@gmail.com

On 18.08.20 06:42, Phil Race wrote:
what printer, driver, and os?
did you call any methods to verify the values being passed are supported ?

-Phil.

On Aug 17, 2020, at 9:01 PM, Tobias Oelgarte <tobias.oelga...@gmail.com> wrote:

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.oelga...@gmail.com

Reply via email to