This is a problem with the reading of JPEG images in 1.8 that is fixed in the unreleased 2.0 (where we use a different strategy to read JPEG files), but not in 1.8. I confirmed this by extracting one of the inline images that brings the problem. It can't be read with ImageIO.read(), not with the sun version and not with the twelvemonkeys (which usuallly can read all).

Try the 2.0 version:
https://pdfbox.apache.org/downloads.html#scm
Note hat the API is different, see in the examples.

Tilman

Am 28.04.2015 um 23:05 schrieb Gregor Kovač:
Hi!

At this link
https://drive.google.com/file/d/0B-qoYfDTAZ8QN3V4ang4bEJIN3c/view?usp=sharing
is original PDF
At this link
https://drive.google.com/file/d/0B-qoYfDTAZ8QcjRBMWRBZE50Snc/view?usp=sharing
is what gets printed.

Best regards,
     Kovi

2015-04-28 18:10 GMT+02:00 Tilman Hausherr <thaush...@t-online.de>:

Hi,

PDF files are not attached in the mailing list. Can you upload it to a
public place?

Tilman


Am 28.04.2015 um 10:48 schrieb Gregor Kovač:

Hi!

I've been using PDFBox 1.8.9 for printing PDF files. In the attachment
(eSlog_380_1031000000002_012354698725.pdf) is a PDF file with one picture
in upper left corner, that does not get printed out at all (attachment
"Java Printing.pdf"). There is a blank space instead of picture.

Why?

This is the code I use for printing:
private static void printWithPDFBox(File pdfFile, int copies) {
         boolean silentPrint = true;
         String printerName = null;
         String password = null;
         PDDocument document = null;
         try {
             document = PDDocument.load(pdfFile);

             if (document.isEncrypted()) {
                 document.decrypt(password);
             }

             PrinterJob printJob = PrinterJob.getPrinterJob();
             printJob.setJobName(pdfFile.getName());

             if (printerName != null) {
                 PrintService[] printService =
PrinterJob.lookupPrintServices();
                 boolean printerFound = false;
                 for (int i = 0; !printerFound && i < printService.length;
i++) {
                     if (printService[i].getName().indexOf(printerName) !=
-1) {
printJob.setPrintService(printService[i]);
                         printerFound = true;
                     }
                 }
             }

             printJob.setPageable(new PDPageable(document, printJob));
             printJob.setCopies(copies);
             if (silentPrint || printJob.printDialog()) {
                 printJob.print();
             }
         } catch (Exception e) {
             e.printStackTrace();
         } finally {
             if (document != null) {
                 try {
                     document.close();
                 } catch (IOException e) {
                     e.printStackTrace();
                 }
             }
         }
     }

Best regards,
     Kovi

--
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
|  In A World Without Fences Who Needs Gates?  |
|              Experience Linux.               |
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org

Reply via email to