If only decoding images was that simple. Have a look at
http://itext.svn.sourceforge.net/viewvc/itext/trunk/src/core/com/itextpdf/text/pdf/parser/PdfImageObject.java?revision=4571&view=markup.
Paulo
----- Original Message -----
From: artfhc
To: [email protected]
Sent: Friday, December 03, 2010 12:40 AM
Subject: [iText-questions] FlateDecode Problem
So I am having problems of extracting an image from a pdf file. After I get
the image stream and identify the decoding method as FlateDecode, I decode
it and create an image file. But somehow the ImageIO.read(inputStream) is
giving me a nullpointerexception. What is the problem? Am I decoding the
image data wrong? Please advise.
byte[] actualBytes = PdfReader.getStreamBytesRaw(imgStream);
byte[] desBytes = actualBytes;
if(imgStream.get(PdfName.FILTER).equals(PdfName.FLATEDECODE))
desBytes = PdfReader.FlateDecode(actualBytes,true);
InputStream inputStream = new ByteArrayInputStream(desBytes) ;
BufferedImage actualBuffer = ImageIO.read(inputStream);
ImageIO.write((RenderedImage)actualBuffer, "tiff", new File(dir +
"PAGE_"+i+"_LINK_"+num+".tiff"));
--
View this message in context:
http://itext-general.2136553.n4.nabble.com/FlateDecode-Problem-tp3070497p3070497.html
Sent from the iText - General mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Many questions posted to this list can (and will) be answered with a
reference to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php
------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php