You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by sp...@gmx.eu on 2011/06/13 10:32:18 UTC

PDF to Image

Hi,

when I convert some PDF documents to an image (png) I get an empty image
back. Only thing I can see is this warning:

WARN org.apache.pdfbox.util.operator.pagedrawer.Invoke.process(77);
getRGBImage returned NULL


Looking into the source (1.5.0), I see this:

PDXObjectImage image = (PDXObjectImage)xobject;
            try
            {
                image.setGraphicsState(drawer.getGraphicsState());
                BufferedImage awtImage = image.getRGBImage();
                if (awtImage == null) 
                {
                    log.warn("getRGBImage returned NULL");
                    return;//TODO PKOCH
                }

...


Bug? 
Not ready?

Thank you


RE: PDF to Image

Posted by sp...@gmx.eu.
OK, now I got it.

jai_imageio.jar must before jai_code.jar in the classpath otherwise one gets
the "getRGBImage returned NULL" message. Seems that both jars contain the
same classes but different impl?
 

> -----Original Message-----
> From: Andreas Lehmkuehler [mailto:andreas@lehmi.de] 
> Sent: Montag, 20. Juni 2011 20:02
> To: users@pdfbox.apache.org
> Subject: Re: PDF to Image
> 
> Hi,
> 
> Am 17.06.2011 09:35, schrieb spring@gmx.eu:
> >> Hmmm, it worked in other cases, however the best idea is to
> >> wait for the next
> >> release.
> >
> > OK. For when is the next release palnned?
> We don't have a strict roadmap. If nothing unforseen happens, 
> it will be out 
> next month.
> 
> BR
> Andreas Lehmkühler
> 


Re: PDF to Image

Posted by Andreas Lehmkuehler <an...@lehmi.de>.
Hi,

Am 21.06.2011 14:12, schrieb spring@gmx.eu:
>> jai_imageio.jar must before jai_code.jar in the classpath
>> otherwise one gets the "getRGBImage returned NULL" message.
>> Seems that both jars contain the same classes but different impl?
>
> Sorry, this was nonsense, I had a typo in my classpath.
>
> Snapshot 1.6.0 does the job now since no need for imageio any more.
Thanks for the feedback.

BR
Andreas Lehmkühler

RE: PDF to Image

Posted by sp...@gmx.eu.
> jai_imageio.jar must before jai_code.jar in the classpath 
> otherwise one gets the "getRGBImage returned NULL" message. 
> Seems that both jars contain the same classes but different impl?

Sorry, this was nonsense, I had a typo in my classpath.

Snapshot 1.6.0 does the job now since no need for imageio any more.

Thank you


Re: PDF to Image

Posted by Andreas Lehmkuehler <an...@lehmi.de>.
Hi,

Am 17.06.2011 09:35, schrieb spring@gmx.eu:
>> Hmmm, it worked in other cases, however the best idea is to
>> wait for the next
>> release.
>
> OK. For when is the next release palnned?
We don't have a strict roadmap. If nothing unforseen happens, it will be out 
next month.

BR
Andreas Lehmkühler

RE: PDF to Image

Posted by sp...@gmx.eu.
> Hmmm, it worked in other cases, however the best idea is to 
> wait for the next 
> release.

OK. For when is the next release palnned?

Thank you


Re: PDF to Image

Posted by Andreas Lehmkuehler <an...@lehmi.de>.
Hi,

Am 16.06.2011 08:50, schrieb spring@gmx.eu:
>> The PDF works well using the current trunk. Prior versions<=
>> 1.5.0 have to use
>> an additional ImageIO plugin to handle the CCITTFax-encoded
>> image. See [1] for
>> further details.
>
> So I need a version>  1.5.0?
Yes, that would be the best choice. But you have to wait a couple of weeks for 
the next release.

>> [1] https://issues.apache.org/jira/browse/PDFBOX-955
>
>
> Hm, my app uses already jai_core.jar, jai_codec.jar and jai_imageio.jar...
Hmmm, it worked in other cases, however the best idea is to wait for the next 
release.

BR
Andreas Lehmkühler

RE: PDF to Image

Posted by sp...@gmx.eu.
> The PDF works well using the current trunk. Prior versions <= 
> 1.5.0 have to use 
> an additional ImageIO plugin to handle the CCITTFax-encoded 
> image. See [1] for 
> further details.

So I need a version > 1.5.0?

> [1] https://issues.apache.org/jira/browse/PDFBOX-955


Hm, my app uses already jai_core.jar, jai_codec.jar and jai_imageio.jar...


Re: PDF to Image

Posted by Andreas Lehmkuehler <an...@lehmi.de>.
Hi,

Am 14.06.2011 20:57, schrieb spring@gmx.eu:
> Upds, attachments not allowed in this group, so I have uploaded it here:
>
> http://www.2shared.com/document/W8eTX2hS/0_online.html
The PDF works well using the current trunk. Prior versions <= 1.5.0 have to use 
an additional ImageIO plugin to handle the CCITTFax-encoded image. See [1] for 
further details.

BR
Andreas Lehmkühler

[1] https://issues.apache.org/jira/browse/PDFBOX-955

RE: PDF to Image

Posted by sp...@gmx.eu.
Upds, attachments not allowed in this group, so I have uploaded it here:

http://www.2shared.com/document/W8eTX2hS/0_online.html 

> -----Original Message-----
> From: spring@gmx.eu [mailto:spring@gmx.eu] 
> Sent: Dienstag, 14. Juni 2011 20:32
> To: users@pdfbox.apache.org
> Subject: RE: PDF to Image
> 
> > Without having a hand on the pdf this will be only a guess. 
> 
> I have attached the pdf. It is a TIFF wrapped by a PDF 
> (generated by iText
> 1.4.1).
> 
> 
> > It sounds like an 
> > issue which should be resolved in the current trunk. Did you 
> > ever try the most 
> > recent dev-version?
> 
> 
> 
> This is what I traced when I call convertToImage on this pdf. 
> I used V 1.3.1
> now, because I had another project where this already worked:
> 
> org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); 
> processing
> substream token: PDFOperator{q}
> org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); 
> processing
> substream token: PDFOperator{q}
> org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); 
> processing
> substream token: COSFloat{295.56}
> org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); 
> processing
> substream token: COSInt{0}
> org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); 
> processing
> substream token: COSInt{0}
> org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); 
> processing
> substream token: COSFloat{660.24}
> org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); 
> processing
> substream token: COSInt{0}
> org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); 
> processing
> substream token: COSInt{1}
> org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); 
> processing
> substream token: PDFOperator{cm}
> org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); 
> processing
> substream token: COSName{img0}
> org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); 
> processing
> substream token: PDFOperator{Do}
> org.apache.pdfbox.util.operator.pagedrawer.Invoke.process(77);
>  getRGBImage
> returned NULL
> org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); 
> processing
> substream token: PDFOperator{Q}
> org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); 
> processing
> substream token: PDFOperator{Q}
> org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); 
> processing
> substream token: PDFOperator{q}
> org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); 
> processing
> substream token: PDFOperator{BT}
> org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); 
> processing
> substream token: COSInt{0}
> org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); 
> processing
> substream token: COSFloat{661.24}
> org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); 
> processing
> substream token: PDFOperator{Td}
> org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); 
> processing
> substream token: COSInt{0}
> org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); 
> processing
> substream token: COSFloat{-660.24}
> org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); 
> processing
> substream token: PDFOperator{Td}
> org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); 
> processing
> substream token: PDFOperator{ET}
> org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); 
> processing
> substream token: PDFOperator{Q}
> 
> 
> Thank you
> 


RE: PDF to Image

Posted by sp...@gmx.eu.
> Without having a hand on the pdf this will be only a guess. 

I have attached the pdf. It is a TIFF wrapped by a PDF (generated by iText
1.4.1).


> It sounds like an 
> issue which should be resolved in the current trunk. Did you 
> ever try the most 
> recent dev-version?



This is what I traced when I call convertToImage on this pdf. I used V 1.3.1
now, because I had another project where this already worked:

org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); processing
substream token: PDFOperator{q}
org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); processing
substream token: PDFOperator{q}
org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); processing
substream token: COSFloat{295.56}
org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); processing
substream token: COSInt{0}
org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); processing
substream token: COSInt{0}
org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); processing
substream token: COSFloat{660.24}
org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); processing
substream token: COSInt{0}
org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); processing
substream token: COSInt{1}
org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); processing
substream token: PDFOperator{cm}
org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); processing
substream token: COSName{img0}
org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); processing
substream token: PDFOperator{Do}
org.apache.pdfbox.util.operator.pagedrawer.Invoke.process(77); getRGBImage
returned NULL
org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); processing
substream token: PDFOperator{Q}
org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); processing
substream token: PDFOperator{Q}
org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); processing
substream token: PDFOperator{q}
org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); processing
substream token: PDFOperator{BT}
org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); processing
substream token: COSInt{0}
org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); processing
substream token: COSFloat{661.24}
org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); processing
substream token: PDFOperator{Td}
org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); processing
substream token: COSInt{0}
org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); processing
substream token: COSFloat{-660.24}
org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); processing
substream token: PDFOperator{Td}
org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); processing
substream token: PDFOperator{ET}
org.apache.pdfbox.util.PDFStreamEngine.processSubStream(269); processing
substream token: PDFOperator{Q}


Thank you

Re: PDF to Image

Posted by Andreas Lehmkuehler <an...@lehmi.de>.
Hi,

Am 13.06.2011 10:32, schrieb spring@gmx.eu:
> Hi,
>
> when I convert some PDF documents to an image (png) I get an empty image
> back. Only thing I can see is this warning:
>
> WARN org.apache.pdfbox.util.operator.pagedrawer.Invoke.process(77);
> getRGBImage returned NULL
>
>
> Looking into the source (1.5.0), I see this:
>
> PDXObjectImage image = (PDXObjectImage)xobject;
>              try
>              {
>                  image.setGraphicsState(drawer.getGraphicsState());
>                  BufferedImage awtImage = image.getRGBImage();
>                  if (awtImage == null)
>                  {
>                      log.warn("getRGBImage returned NULL");
>                      return;//TODO PKOCH
>                  }
>
> ...
>
>
> Bug?
> Not ready?
Without having a hand on the pdf this will be only a guess. It sounds like an 
issue which should be resolved in the current trunk. Did you ever try the most 
recent dev-version?

> Thank you


BR
Andreas Lehmkühler