In my javafx application , I'm using JavaFX 8 printing API to print a node , i am getting problem of the printing area , despite i have set the pageLayout with A4 paper .... here is my code :
public static void printNode(final Node node) throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException {
Printer printer = Printer.getDefaultPrinter();
PageLayout pageLayout = printer.createPageLayout(Paper.A4, PageOrientation.PORTRAIT, 0,0,0,0 );
PrinterJob job = PrinterJob.createPrinterJob();
if (job != null && job.showPrintDialog(node.getScene().getWindow()) ) {
boolean success = job.printPage(pageLayout, node);
if (success) {
job.endJob();
}
}
And here is a snapshot of the node that i want to print it is :
and here is what i am getting when i print the node
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…