Jose,
Thanks for the reply.  I eventually use the images to do further 
processing to find QR codes which should be present in the file before 
attaching the documents within a document management system.  So, I need 
to get the image as a java BufferedImage object.

Glenn




Hi Glenn, 
If I understood right you might want to try: 
imagePDX.write2OutputStream(outputStream); or imagePDX.write2File(file); 
it could help knowing what you want to do with your image object. 
Cheers. 

-----Mensagem original----- De: Glenn Hirshon [mailto:[email protected]] 
Enviada em: quinta-feira, 12 de agosto de 2010 16:29 Para: 
[email protected] Assunto: error using PDXObjectImage 
[java.lang.Error: Error 5] 
In the code below, running on Solaris using pdfBox 1.2.0, we have had no 
problems extracting images from pdf documents. Recently, we recently 
started accepting files from a new scanning source out of our UK office 
which has caused the program to throw a java error. Code and error 
stack-trace shown below. 
Does anyone know a valid work-around? 
try{ image = page.convertToImage(); } catch(Exception eImage){ PDResources 
resources = page.getResources(); Map images = resources.getImages(); if( 
images != null ) {//only expects one image per page Iterator imageIter = 
images.keySet().iterator(); while( imageIter.hasNext() ) { String key = 
(String )imageIter.next(); PDXObjectImage imagePDX = null; imagePDX = 
(PDXObjectImage)images.get( key ); 
image = imagePDX.getRGBImage(); } } 
/* end new extraction method*/ 
} 
java.lang.Error: Error 5 at 
com.sun.media.imageioimpl.plugins.tiff.TIFFFaxDecompressor.decodeT6(TIFFFaxD 
ecompressor.java:1129) at 
com.sun.media.imageioimpl.plugins.tiff.TIFFFaxDecompressor.decodeRaw(TIFFFax 
Decompressor.java:651) at 
com.sun.media.imageioimpl.plugins.tiff.TIFFCodecLibFaxDecompressor.decodeRaw 
(TIFFCodecLibFaxDecompressor.java:112) at 
com.sun.media.imageio.plugins.tiff.TIFFDecompressor.decode(TIFFDecompressor. 
java:2488) at 
com.sun.media.imageioimpl.plugins.tiff.TIFFImageReader.decodeTile(TIFFImageR 
eader.java:963) at 
com.sun.media.imageioimpl.plugins.tiff.TIFFImageReader.read(TIFFImageReader. 
java:1240) at javax.imageio.ImageIO.read(ImageIO.java:1400) at 
javax.imageio.ImageIO.read(ImageIO.java:1322) at 
org.apache.pdfbox.pdmodel.graphics.xobject.PDCcitt.getRGBImage(PDCcitt.java: 
120) at 
org.apache.pdfbox.util.operator.pagedrawer.Invoke.process(Invoke.java:74) 
at 
org.apache.pdfbox.util.PDFStreamEngine.processOperator(PDFStreamEngine.java: 
567) at 
org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java 
:250) at 
org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:20 
8) at org.apache.pdfbox.pdfviewer.PageDrawer.drawPage(PageDrawer.java:112) 
at org.apache.pdfbox.pdmodel.PDPage.convertToImage(PDPage.java:718) at 
org.apache.pdfbox.pdmodel.PDPage.convertToImage(PDPage.java:689) at 
oz.ozReadBarcode.oz_pdf_process(ozReadBarcode.java:963) at 
oz.ozReadBarcode.oz_pdf_process_files(ozReadBarcode.java:1178) at 
oz.ozReadBarcode.main(ozReadBarcode.java:350) Process exited with exit 
code 0. 



The information contained in this message and any attachment(s) may be 
privileged, confidential, proprietary or otherwise protected from 
disclosure and is intended solely for the use of the individual or entity 
to whom it is addressed. If you are not the intended recipient, you are 
hereby notified that any dissemination, distribution, copying or use of 
this message and any attachment is strictly prohibited and may be 
unlawful. If you have received this message in error, please notify us 
immediately by replying to this email and permanently delete the message 
from your computer. 

Nothing contained in this message and/or any attachment(s) constitutes a 
solicitation or an offer to buy or sell any securities. 


The information contained in this message and any attachment(s) may be 
privileged, confidential, proprietary or otherwise protected from 
disclosure and is intended solely for the use of the individual or entity 
to whom it is addressed. If you are not the intended recipient, you are 
hereby notified that any dissemination, distribution, copying or use of 
this message and any attachment is strictly prohibited and may be 
unlawful. If you have received this message in error, please notify us 
immediately by replying to this email and permanently delete the message 
from your computer. 

Nothing contained in this message and/or any attachment(s) constitutes a 
solicitation or an offer to buy or sell any securities. 

Reply via email to