Answers for "pdfbox print example"

0

pdfbox print example

public static PrintService choosePrinter() {
    PrinterJob printJob = PrinterJob.getPrinterJob();
    if(printJob.printDialog()) {
        return printJob.getPrintService();          
    }
    else {
        return null;
    }
}

public static void printPDF(String fileName, PrintService printer)
        throws IOException, PrinterException {
    PrinterJob job = PrinterJob.getPrinterJob();
    job.setPrintService(printer);
    PDDocument doc = PDDocument.load(fileName);
    doc.silentPrint(job);
}
Posted by: Guest on August-28-2020

Code answers related to "pdfbox print example"

Browse Popular Code Answers by Language