I am tryin to insert a BufferedImage into a page with no success, I have 
also read section 2.3.3
of MEAP book with no sucess. By the way this session is a little 
confusing (why the example of
rectangle?)

I get the image from Jfreechart, and the image in fact appears but 
always with a black beckground.
I found no way to change that. The image is probably transparent. Here 
is my code:

    BufferedImage img = chart.createBufferedImage(width, height);

    ByteArrayOutputStream os = new ByteArrayOutputStream();

    JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(os);

    try {

      encoder.encode(img);

    } catch (ImageFormatException e1) {

      throw new RuntimeException("Unexpected error", e1);

    } catch (IOException e1) {

      throw new RuntimeException("Unexpected error", e1);

    }

    byte[] byteArray = os.toByteArray();

    try {

      Image image = Image.getInstance(byteArray);

      doc.add(image);

    } catch (MalformedURLException e) {

      throw new RuntimeException("Unexpected error", e);

    } catch (IOException e) {

      throw new RuntimeException("Unexpected error", e);

    }

Any idea of what's going on?

Thanks,

franco



------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to