This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Other Open Source Projects and the fly likes convert java.awt.Image to com.lowagie.text.Image Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "convert java.awt.Image to com.lowagie.text.Image" Watch "convert java.awt.Image to com.lowagie.text.Image" New topic

convert java.awt.Image to com.lowagie.text.Image

vinitha simon
Ranch Hand

Joined: Dec 13, 2007
Posts: 64
I have a byte[], which I convert to an java.awt.Image by

Now, I need to write this image to a PDF using iText, but, iText accepts 'com.lowagie.text.Image'... Any suggestions on how to convert between the 2 image formats....

Any help is appreciated.

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42959
There's no need to convert the byte array into a BufferedImage - the iText Image class has methods for creating images from lots of sources, including byte arrays. Check its javadocs for details.
vinitha simon
Ranch Hand

Joined: Dec 13, 2007
Posts: 64
Thanks Ulf.

I also figured out

should work as well.
I agree. Here's the link:
subject: convert java.awt.Image to com.lowagie.text.Image
It's not a secret anymore!