File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
vinitha simon
Ranch Hand
Posts: 64
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Folks,
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.

TIA
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 64
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ulf.

I also figured out



should work as well.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic