I am referencing an email I saw dated Fri, 07 Dec 2007 02:20:51 -0800 image + 
classpath.

I am using the latest 2.1.3 version of  iText. 
I am still having trouble making an image show up for RTF when I use the 
classloader (file is in jar file under classes), which is the only option I 
have open to me.
This email suggests using a byte array stream. I have and I get the the byte 
data just fine but no Image shows. My code is included:

InputStream instream = 
getClass.getClassLoader().getResourceAsStream("test.gif");

ByteArrayOutputStream outputStream = new ByteArrayOutputStream (1024);
byte[] bytes = new byte[512];
int readBytes = 0;
while ((readBytes = instream.read(bytes)) > 0) {
   outputStream.write(bytes,0,readBytes);
}

byte[] byteData = outputStream.toByteArray();

com.lowagie.text.Image image = com.lowagie.text.Image.getInstance(byteData);
Cell cell = new Cell(image);
...add cell to table of document that is either HTML or RTF
Also as an aside I have to generate an HTML file that contains the image. The 
only time I get an image to show is if the middleware hands me byte[] data from 
the database for RTF. That same code doesn't work for HTML. I can't use URLs 
because we have certificate issues. 

Any help would be appreciated! Thanks!

Ginny

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php

Reply via email to