Description
I have a PDF with 2 images in it on 2 separate pages. Each page also has some text. When I try to print the PDF, the first page renders fine, but nothing renders for the second page and I get a blank page printed.
String sourcePDF = "C:\\temp\\CPTest\\MyTest.pdf"; PrinterJob job = PrinterJob.getPrinterJob(); try (PDDocument document = PDDocument.load(new File(sourcePDF))) { job.setPageable(new PDFPageable(document); PrintService service = getPrintService("Adobe PDF"); job.setPrintService(service); job.print(); } catch (IOException | PrinterException e) { throw new RuntimeException("Unable to print file " + sourcePDF + ".", e); }
I have also tried printing to a physical printer with the same results. Saves me paper by just using the Adobe PDF printer.
Attachments
Issue Links
- relates to
-
PDFBOX-3729 Spooling configurations of printer affects large PDF [Contains MS word tiling pattern] printing
- Open
-
PDFBOX-4010 A (rotated) barcode is missing from a pdf when printed
- Closed
Activity
Field | Original Value | New Value |
---|---|---|
Attachment | Mytest.pdf [ 12866218 ] |
Attachment | Java Printing Test.pdf [ 12866219 ] |
Description | I have a PDF with 2 images in it on 2 separate pages. Each page also has some text. When I try to print the PDF, the first page renders fine, but nothing renders for the second page and I get a blank page printed. |
I have a PDF with 2 images in it on 2 separate pages. Each page also has some text. When I try to print the PDF, the first page renders fine, but nothing renders for the second page and I get a blank page printed. {code} String sourcePDF = "C:\\temp\\CPTest\\MyTest.pdf"; PrinterJob job = PrinterJob.getPrinterJob(); try (PDDocument document = PDDocument.load(new File(sourcePDF))) { job.setPageable(new PDFPageable(document); PrintService service = getPrintService("Adobe PDF"); job.setPrintService(service); job.print(); } catch (IOException | PrinterException e) { throw new RuntimeException("Unable to print file " + sourcePDF + ".", e); } {code} |
Description |
I have a PDF with 2 images in it on 2 separate pages. Each page also has some text. When I try to print the PDF, the first page renders fine, but nothing renders for the second page and I get a blank page printed. {code} String sourcePDF = "C:\\temp\\CPTest\\MyTest.pdf"; PrinterJob job = PrinterJob.getPrinterJob(); try (PDDocument document = PDDocument.load(new File(sourcePDF))) { job.setPageable(new PDFPageable(document); PrintService service = getPrintService("Adobe PDF"); job.setPrintService(service); job.print(); } catch (IOException | PrinterException e) { throw new RuntimeException("Unable to print file " + sourcePDF + ".", e); } {code} |
I have a PDF with 2 images in it on 2 separate pages. Each page also has some text. When I try to print the PDF, the first page renders fine, but nothing renders for the second page and I get a blank page printed. {code} String sourcePDF = "C:\\temp\\CPTest\\MyTest.pdf"; PrinterJob job = PrinterJob.getPrinterJob(); try (PDDocument document = PDDocument.load(new File(sourcePDF))) { job.setPageable(new PDFPageable(document); PrintService service = getPrintService("Adobe PDF"); job.setPrintService(service); job.print(); } catch (IOException | PrinterException e) { throw new RuntimeException("Unable to print file " + sourcePDF + ".", e); } {code} I have also tried printing to a physical printer with the same results. Saves me paper by just using the Adobe PDF printer. |
Affects Version/s | 2.0.5 [ 12338759 ] |
Component/s | Rendering [ 12322302 ] |
Labels | printing |
Attachment | PDFBOX-3776-reduced.pdf [ 12866243 ] |
Link | This issue relates to PDFBOX-3729 [ PDFBOX-3729 ] |
Attachment | CMC-MBOM-001_PATTARO Roberto.pdf [ 12866413 ] |
Attachment | CMC-MBOM-001_PATTARO Roberto.pdf [ 12866413 ] |
Comment | [ So...that resolved the issue. However, I was using this PDF as something to reproduce the real issue I have with a document from a client that I'm not sure I can share. I will ask the client if I can share a single page of that document that illustrates the issue and will attach it. ] |
Comment | [ Attaching the PDF file that I cannot get printed from the client. The first two pages print, but the rest only have the footer / header and not the image. ] |
Comment | [ It was not. I installed it and was able to print correctly. Thank you for the quick responses and guidance. ] |
Comment | [ I spoke too soon. This resolved the issue with the images, but when I print to a printer, the A4 pages are not shrinking. I did create a class that essentially is PDFPageable but takes a scaling property (shrink to fit) when creating the PDFPrinter object. However, the A4 pages still print on the Letter size paper. Any suggestions? Should I instead post this on SO? ] |
Comment | [ Yes, there or on the mailing list, but improve your description, i.e. does your printer only have letter? Include as much as possible of your code. To clean up this issue, please remove the latest file and all comments (i.e. all of today, and the "So...that resolved the issue" (it doesn't,, it's just a workaround)) related to the jbig2 issue, I'll delete mine too including this one. This is just to focus on the original problem. ] |
Comment | [ That one I can print. Is the levigo jbig2 decoder plugin installed? ] |
Labels | printing | print printing |
Link |
This issue relates to |
Resolution | Cannot Reproduce [ 5 ] | |
Status | Open [ 1 ] | Closed [ 6 ] |
The Java Printing Test.pdf is the result of printing.