Hello! "org.apache.pdfbox.printing.PDFPageable.PDFPageable(PDDocument)" does not work as expected when printing a specific page using the print dialog.
Steps to reproduce: 1. Run the example code mentioned in this mail, after setting the "file" to a valid PDF file. 2. Select "Range from" option on the displayed print settings dialog. 3. Type "2" in both the "from" and "to" text boxes. 4. Click Print. 5. Notice that the application just quits. When this code is integrated in our application (Cook'n - https://www.dvo.com/download/CooknMacClassic.zip), it crashes. *package* com.print.test; *import* java.awt.print.PrinterJob; *import* java.io.File; *import* org.apache.pdfbox.Loader; *import* org.apache.pdfbox.io.RandomAccessReadBufferedFile; *import* org.apache.pdfbox.pdmodel.PDDocument; *import* org.apache.pdfbox.printing.PDFPageable; *public* *class* ApachePdfPrintTest { *private* *static* *final* File *file* = *new* File("PATH_TO_PDF_FILE"); *public* *static* *void* main(String[] args) { *try* { *final* PrinterJob pJob = PrinterJob.*getPrinterJob*(); //final PDDocument doc = PDDocument.load(file); *final* PDDocument doc = Loader.*loadPDF*(*new* RandomAccessReadBufferedFile(*file*)); pJob.setPageable(*new* PDFPageable(doc)); *if* (pJob.printDialog()) { pJob.print(); } } *catch* (*final* Exception e) { e.printStackTrace(); } } } I have also attached the PDF file which I used to test. Is there any way I can get this to work? Thank you, Seethalakshmi S
--------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org For additional commands, e-mail: users-h...@pdfbox.apache.org