PrinterJob pJ = PrinterJob.createPrinterJob();
if (pJ != null) {
boolean success = pJ.printPage(some-node);
if (success) {
pJ.endJob();
}
}
This prints to the default printer without showing any dialog to the user. To use a printer other than the default you can use th...
PrinterJob pJ = PrinterJob.createPrinterJob();
if (pJ != null) {
boolean success = pJ.showPrintDialog(primaryStage);// this is the important line
if (success) {
pJ.endJob();
}
}