I am trying to convert an itext image to a java.awt image.

I use the below code to do that

 Image image = Image.getInstance(img, null);
 image.setDpi(300, 300);

 ByteArrayOutputStream bas = new ByteArrayOutputStream();
* ImageIO.write((RenderedImage)image, "png", bas);*

 byte[] data = bas.toByteArray();

 InputStream in = new ByteArrayInputStream(data);
 BufferedImage finalImage = ImageIO.read(in);

I get an exception-

java.lang.ClassCastException: com.lowagie.text.ImgRaw cannot be cast to
java.awt.image.RenderedImage at com.cerdpi.Pdf2Image.main

Can anyone help me?
------------------------------------------------------------------------------
Keep yourself connected to Go Parallel: 
VERIFY Test and improve your parallel project with help from experts 
and peers. http://goparallel.sourceforge.net
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
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

Reply via email to