You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Gregor Kovač <ko...@gmail.com> on 2015/04/28 10:48:11 UTC

Picture not printed

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.               |
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~

Custom glyph maps for a PDF fonts

Posted by Zeev Sands <ze...@gmail.com>.
Hello everyone,

I've been using pdfbox 2.0 for a couple of weeks and came across an 
issue with a couple of symbol fonts (WPIconicSymbolsA and 
WPTypographicSymbols).:
I need to convert the symbols to their unicode equivalents if possible, 
so I cooked up a small class to do that. No problems there.

My issue is - some of the symbols coming in are already being converted 
and some are not. I do see that there is a list of glyphs that is being 
loaded to do just that (glyphlist.txt) and there is an additional list 
(additional.txt) for more glyphs. What I don't understand is how a glyph 
can be mapped without specifying a font name, for example in 
WPIconicSymbolsA dec 33 is an outline of a heart, in 
WPTypographicSymbols dec 33 is a large filled dot.

So to be specific, my questions are :

   Is there any way to give pdf box a map *per font*?

   What is the philosophy of glyph conversion how are different fonts 
converted to different unicode characters?

Please, let me know if I am looking at the whole thing incorrectly. 
Perhaps there is an easier way...

Thank you,
Zeev



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


Re: Picture not printed

Posted by Gregor Kovač <ko...@gmail.com>.
Hi!

No, that file is just an example. not confidential in any way.

Best regards,
    Kovi

2015-04-29 19:42 GMT+02:00 Tilman Hausherr <TH...@t-online.de>:

> Hi,
>
> Done. You'll find a new version here:
>
> https://repository.apache.org/content/groups/snapshots/org/apache/pdfbox/pdfbox-app/1.8.10-SNAPSHOT/
>
> About the creator of that PDF - if it was done by a partner of your
> company, please contact the vendor (Datalab "Pantheon PDF export") and
> point them to
> https://issues.apache.org/jira/browse/PDFBOX-2501
> http://bugs.ghostscript.com/show_bug.cgi?format=multiple&id=690734
>
>
> Tilman
>
>
> Am 29.04.2015 um 17:58 schrieb Tilman Hausherr:
>
>> In the meantime the developer of twelvemonkeys answered, and pointed me
>> to the real reason: not the JPEG is malformed, it is the PDF. This bug is
>> described in
>> https://issues.apache.org/jira/browse/PDFBOX-2501
>> but solved for 2.0 only. I'll apply for 1.8 and then come back to you.
>>
>> Btw, that file, is it somehow confidential?
>>
>> Tilman
>>
>> Am 29.04.2015 um 13:36 schrieb Gregor Kovač:
>>
>>> Hi!
>>>
>>> I see. Great.
>>>
>>> Thanks for all your help.
>>>
>>> Best regards,
>>>      Kovi
>>>
>>> 2015-04-29 7:49 GMT+02:00 Tilman Hausherr <TH...@t-online.de>:
>>>
>>>  Hi,
>>>>
>>>> The plan was to release it when all, or at least the blocker issues are
>>>> solved:
>>>>
>>>>
>>>> https://issues.apache.org/jira/issues/?jql=fixVersion%20%3D%202.0.0%20AND%20project%20%3D%20PDFBOX%20AND%20resolution%20%3D%20Unresolved%20ORDER%20BY%20updated%20DESC%2C%20key%20DESC%2C%20priority%20DESC
>>>>
>>>> How I extracted the image - I changed the source code to save the file
>>>> before attempting to decode it. I inserted this code at the beginning of
>>>> decode() in JPXFilter.java in the 1.8 version:
>>>>
>>>>          ByteArrayOutputStream baos = new ByteArrayOutputStream();
>>>>          IOUtils.copy(compressedData, baos);
>>>>          String filename = System.currentTimeMillis()+".jpg";
>>>>          FileOutputStream fos = new FileOutputStream(new
>>>> File("INSERT___DIRECTORY____",filename));
>>>>          fos.write(baos.toByteArray());
>>>>          fos.close();
>>>>          compressedData = new ByteArrayInputStream(baos.toByteArray());
>>>>          System.out.println("jpeg filename: " + filename);
>>>>
>>>> They might also be extracted by the ExtractImages tool of the 2.0
>>>> version
>>>> (not by the 1.8 version, that one doesn't support inline images).
>>>>
>>>> Here is one of the JPEG files:
>>>> http://home.snafu.de/tilman/tmp/1430258221574.jpg
>>>>
>>>> I also opened an issue with twelvemonkeys, as it can't read the file
>>>> either with ImageIO.read(), and the developer may give some insight
>>>> about
>>>> that file.
>>>> https://github.com/haraldk/TwelveMonkeys/issues/132
>>>>
>>>> Tilman
>>>>
>>>>
>>>> Am 29.04.2015 um 01:20 schrieb Gregor Kovač:
>>>>
>>>>  Hi!
>>>>>
>>>>> I tried version 2.0 and it does print the picture. Nice.
>>>>> Is ETA for 2.0 set? How did you extract images from PDF?
>>>>>
>>>>> Best regards,
>>>>>       Kovi
>>>>>
>>>>> 2015-04-29 0:11 GMT+02:00 Tilman Hausherr <TH...@t-online.de>:
>>>>>
>>>>>   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 <TH...@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-unsubscribe@pdfbox.apache.org
>>>>>>>>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>
>>>>>>>>>
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>>>>>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>>  ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>>>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>>>
>>>>
>>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>
>


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

Re: Picture not printed

Posted by Tilman Hausherr <TH...@t-online.de>.
Hi,

Done. You'll find a new version here:
https://repository.apache.org/content/groups/snapshots/org/apache/pdfbox/pdfbox-app/1.8.10-SNAPSHOT/

About the creator of that PDF - if it was done by a partner of your 
company, please contact the vendor (Datalab "Pantheon PDF export") and 
point them to
https://issues.apache.org/jira/browse/PDFBOX-2501
http://bugs.ghostscript.com/show_bug.cgi?format=multiple&id=690734


Tilman

Am 29.04.2015 um 17:58 schrieb Tilman Hausherr:
> In the meantime the developer of twelvemonkeys answered, and pointed 
> me to the real reason: not the JPEG is malformed, it is the PDF. This 
> bug is described in
> https://issues.apache.org/jira/browse/PDFBOX-2501
> but solved for 2.0 only. I'll apply for 1.8 and then come back to you.
>
> Btw, that file, is it somehow confidential?
>
> Tilman
>
> Am 29.04.2015 um 13:36 schrieb Gregor Kovač:
>> Hi!
>>
>> I see. Great.
>>
>> Thanks for all your help.
>>
>> Best regards,
>>      Kovi
>>
>> 2015-04-29 7:49 GMT+02:00 Tilman Hausherr <TH...@t-online.de>:
>>
>>> Hi,
>>>
>>> The plan was to release it when all, or at least the blocker issues are
>>> solved:
>>>
>>> https://issues.apache.org/jira/issues/?jql=fixVersion%20%3D%202.0.0%20AND%20project%20%3D%20PDFBOX%20AND%20resolution%20%3D%20Unresolved%20ORDER%20BY%20updated%20DESC%2C%20key%20DESC%2C%20priority%20DESC 
>>>
>>>
>>> How I extracted the image - I changed the source code to save the file
>>> before attempting to decode it. I inserted this code at the 
>>> beginning of
>>> decode() in JPXFilter.java in the 1.8 version:
>>>
>>>          ByteArrayOutputStream baos = new ByteArrayOutputStream();
>>>          IOUtils.copy(compressedData, baos);
>>>          String filename = System.currentTimeMillis()+".jpg";
>>>          FileOutputStream fos = new FileOutputStream(new
>>> File("INSERT___DIRECTORY____",filename));
>>>          fos.write(baos.toByteArray());
>>>          fos.close();
>>>          compressedData = new ByteArrayInputStream(baos.toByteArray());
>>>          System.out.println("jpeg filename: " + filename);
>>>
>>> They might also be extracted by the ExtractImages tool of the 2.0 
>>> version
>>> (not by the 1.8 version, that one doesn't support inline images).
>>>
>>> Here is one of the JPEG files:
>>> http://home.snafu.de/tilman/tmp/1430258221574.jpg
>>>
>>> I also opened an issue with twelvemonkeys, as it can't read the file
>>> either with ImageIO.read(), and the developer may give some insight 
>>> about
>>> that file.
>>> https://github.com/haraldk/TwelveMonkeys/issues/132
>>>
>>> Tilman
>>>
>>>
>>> Am 29.04.2015 um 01:20 schrieb Gregor Kovač:
>>>
>>>> Hi!
>>>>
>>>> I tried version 2.0 and it does print the picture. Nice.
>>>> Is ETA for 2.0 set? How did you extract images from PDF?
>>>>
>>>> Best regards,
>>>>       Kovi
>>>>
>>>> 2015-04-29 0:11 GMT+02:00 Tilman Hausherr <TH...@t-online.de>:
>>>>
>>>>   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 <TH...@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-unsubscribe@pdfbox.apache.org
>>>>>>>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>> --------------------------------------------------------------------- 
>>>>>>>>
>>>>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>>>>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>>>>
>>>>>
>>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>>
>>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>


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


Re: Picture not printed

Posted by Tilman Hausherr <TH...@t-online.de>.
In the meantime the developer of twelvemonkeys answered, and pointed me 
to the real reason: not the JPEG is malformed, it is the PDF. This bug 
is described in
https://issues.apache.org/jira/browse/PDFBOX-2501
but solved for 2.0 only. I'll apply for 1.8 and then come back to you.

Btw, that file, is it somehow confidential?

Tilman

Am 29.04.2015 um 13:36 schrieb Gregor Kovač:
> Hi!
>
> I see. Great.
>
> Thanks for all your help.
>
> Best regards,
>      Kovi
>
> 2015-04-29 7:49 GMT+02:00 Tilman Hausherr <TH...@t-online.de>:
>
>> Hi,
>>
>> The plan was to release it when all, or at least the blocker issues are
>> solved:
>>
>> https://issues.apache.org/jira/issues/?jql=fixVersion%20%3D%202.0.0%20AND%20project%20%3D%20PDFBOX%20AND%20resolution%20%3D%20Unresolved%20ORDER%20BY%20updated%20DESC%2C%20key%20DESC%2C%20priority%20DESC
>>
>> How I extracted the image - I changed the source code to save the file
>> before attempting to decode it. I inserted this code at the beginning of
>> decode() in JPXFilter.java in the 1.8 version:
>>
>>          ByteArrayOutputStream baos = new ByteArrayOutputStream();
>>          IOUtils.copy(compressedData, baos);
>>          String filename = System.currentTimeMillis()+".jpg";
>>          FileOutputStream fos = new FileOutputStream(new
>> File("INSERT___DIRECTORY____",filename));
>>          fos.write(baos.toByteArray());
>>          fos.close();
>>          compressedData = new ByteArrayInputStream(baos.toByteArray());
>>          System.out.println("jpeg filename: " + filename);
>>
>> They might also be extracted by the ExtractImages tool of the 2.0 version
>> (not by the 1.8 version, that one doesn't support inline images).
>>
>> Here is one of the JPEG files:
>> http://home.snafu.de/tilman/tmp/1430258221574.jpg
>>
>> I also opened an issue with twelvemonkeys, as it can't read the file
>> either with ImageIO.read(), and the developer may give some insight about
>> that file.
>> https://github.com/haraldk/TwelveMonkeys/issues/132
>>
>> Tilman
>>
>>
>> Am 29.04.2015 um 01:20 schrieb Gregor Kovač:
>>
>>> Hi!
>>>
>>> I tried version 2.0 and it does print the picture. Nice.
>>> Is ETA for 2.0 set? How did you extract images from PDF?
>>>
>>> Best regards,
>>>       Kovi
>>>
>>> 2015-04-29 0:11 GMT+02:00 Tilman Hausherr <TH...@t-online.de>:
>>>
>>>   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 <TH...@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-unsubscribe@pdfbox.apache.org
>>>>>>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>>>>>>
>>>>>>>
>>>>>>>   ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>>>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>>>
>>>>
>>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>
>>
>


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


Re: Picture not printed

Posted by Gregor Kovač <ko...@gmail.com>.
Hi!

I see. Great.

Thanks for all your help.

Best regards,
    Kovi

2015-04-29 7:49 GMT+02:00 Tilman Hausherr <TH...@t-online.de>:

> Hi,
>
> The plan was to release it when all, or at least the blocker issues are
> solved:
>
> https://issues.apache.org/jira/issues/?jql=fixVersion%20%3D%202.0.0%20AND%20project%20%3D%20PDFBOX%20AND%20resolution%20%3D%20Unresolved%20ORDER%20BY%20updated%20DESC%2C%20key%20DESC%2C%20priority%20DESC
>
> How I extracted the image - I changed the source code to save the file
> before attempting to decode it. I inserted this code at the beginning of
> decode() in JPXFilter.java in the 1.8 version:
>
>         ByteArrayOutputStream baos = new ByteArrayOutputStream();
>         IOUtils.copy(compressedData, baos);
>         String filename = System.currentTimeMillis()+".jpg";
>         FileOutputStream fos = new FileOutputStream(new
> File("INSERT___DIRECTORY____",filename));
>         fos.write(baos.toByteArray());
>         fos.close();
>         compressedData = new ByteArrayInputStream(baos.toByteArray());
>         System.out.println("jpeg filename: " + filename);
>
> They might also be extracted by the ExtractImages tool of the 2.0 version
> (not by the 1.8 version, that one doesn't support inline images).
>
> Here is one of the JPEG files:
> http://home.snafu.de/tilman/tmp/1430258221574.jpg
>
> I also opened an issue with twelvemonkeys, as it can't read the file
> either with ImageIO.read(), and the developer may give some insight about
> that file.
> https://github.com/haraldk/TwelveMonkeys/issues/132
>
> Tilman
>
>
> Am 29.04.2015 um 01:20 schrieb Gregor Kovač:
>
>> Hi!
>>
>> I tried version 2.0 and it does print the picture. Nice.
>> Is ETA for 2.0 set? How did you extract images from PDF?
>>
>> Best regards,
>>      Kovi
>>
>> 2015-04-29 0:11 GMT+02:00 Tilman Hausherr <TH...@t-online.de>:
>>
>>  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 <TH...@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-unsubscribe@pdfbox.apache.org
>>>>>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>>>>>
>>>>>>
>>>>>>  ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>>
>>>
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>
>


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

Re: Picture not printed

Posted by Tilman Hausherr <TH...@t-online.de>.
Hi,

The plan was to release it when all, or at least the blocker issues are 
solved:
https://issues.apache.org/jira/issues/?jql=fixVersion%20%3D%202.0.0%20AND%20project%20%3D%20PDFBOX%20AND%20resolution%20%3D%20Unresolved%20ORDER%20BY%20updated%20DESC%2C%20key%20DESC%2C%20priority%20DESC

How I extracted the image - I changed the source code to save the file 
before attempting to decode it. I inserted this code at the beginning of 
decode() in JPXFilter.java in the 1.8 version:

         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         IOUtils.copy(compressedData, baos);
         String filename = System.currentTimeMillis()+".jpg";
         FileOutputStream fos = new FileOutputStream(new 
File("INSERT___DIRECTORY____",filename));
         fos.write(baos.toByteArray());
         fos.close();
         compressedData = new ByteArrayInputStream(baos.toByteArray());
         System.out.println("jpeg filename: " + filename);

They might also be extracted by the ExtractImages tool of the 2.0 
version (not by the 1.8 version, that one doesn't support inline images).

Here is one of the JPEG files:
http://home.snafu.de/tilman/tmp/1430258221574.jpg

I also opened an issue with twelvemonkeys, as it can't read the file 
either with ImageIO.read(), and the developer may give some insight 
about that file.
https://github.com/haraldk/TwelveMonkeys/issues/132

Tilman

Am 29.04.2015 um 01:20 schrieb Gregor Kovač:
> Hi!
>
> I tried version 2.0 and it does print the picture. Nice.
> Is ETA for 2.0 set? How did you extract images from PDF?
>
> Best regards,
>      Kovi
>
> 2015-04-29 0:11 GMT+02:00 Tilman Hausherr <TH...@t-online.de>:
>
>> 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 <TH...@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-unsubscribe@pdfbox.apache.org
>>>>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>>>>
>>>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>
>>
>


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


Re: Picture not printed

Posted by Gregor Kovač <ko...@gmail.com>.
Hi!

I tried version 2.0 and it does print the picture. Nice.
Is ETA for 2.0 set? How did you extract images from PDF?

Best regards,
    Kovi

2015-04-29 0:11 GMT+02:00 Tilman Hausherr <TH...@t-online.de>:

> 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 <TH...@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-unsubscribe@pdfbox.apache.org
>>>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>>>
>>>>
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>
>


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

Re: Picture not printed

Posted by Tilman Hausherr <TH...@t-online.de>.
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 <TH...@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-unsubscribe@pdfbox.apache.org
>>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>>
>>
>


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


Re: Picture not printed

Posted by Gregor Kovač <ko...@gmail.com>.
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 <TH...@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-unsubscribe@pdfbox.apache.org
>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>
>
>


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

Re: Picture not printed

Posted by Tilman Hausherr <TH...@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-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org