In JavaFX, I want to print out a photo to 10x15 paper. There are some Paper constansts, but there is no 100x150 mm constant.
Is it possible to create an own Paper to use it in PageLayout?
Thanks.
PageLayout pageLayout = printer.createPageLayout(Paper.JAPANESE_POSTCARD, PageOrientation.LANDSCAPE, Printer.MarginType.EQUAL);
double scaleX = pageLayout.getPrintableWidth() / node.getBoundsInParent().getWidth();
double scaleY = pageLayout.getPrintableHeight() / node.getBoundsInParent().getHeight();
node.getTransforms().add(new Scale(scaleX, scaleY));
PrinterJob job = PrinterJob.createPrinterJob(printer);
if (job != null) {
System.out.println("Job created!");
boolean success = job.printPage(node);
if (success) {
System.out.println("Job successfully finished!");
job.endJob();
} else {
System.out.println("Job NOT successful!");
}
}