java code which initiates printing does not work as job is null. I do not have a printer , so the code should prompt for saving as pdf file, which happens.
PrinterJob job = PrinterJob.createPrinterJob();
if (job != null) {
boolean success = job.printPage(sceneToPrint.getRoot());
if (success) {
job.endJob();
}
}
Which additional packages to install or any other setup for print to pdf work ?
I think you just need to configure cups. If you are using gnome, the print dialog should have the option to print to PDF.
I installed printer-driver-cups-pdf. And tried printing to pdf in firefox, but when i select "PDF"(option appeared after installing printer-driver-cups-pdf), nothing happens.
Okay. Its was working. It created a PDF folder in Home, and pdf files were stored there.
Обсуждают сегодня