You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by John Hewson <jo...@jahewson.com> on 2015/07/10 09:28:33 UTC

Printing with 2.0

Hi All,

For those of you printing PDF files with PDFBox 2.0, the APIs have now changed, based on mailing list feedback. We’ve replaced our PDFPrinter wrapper class with a more standard Java API implementation.

Users of PDFPrinter#silentPrint() should now use this code:

PrinterJob job = PrinterJob.getPrinterJob();
job.setPageable(new PDFPageable(document));
job.print();

While users of PDFPrinter#Print() should now use this code:

PrinterJob job = PrinterJob.getPrinterJob();
job.setPageable(new PDFPageable(document));
if (job.printDialog())
{
    job.print();
}

Advanced use case examples can be found here:

https://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/printing/Printing.java?view=markup&pathrev=1690215

— John