Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » iText »

[iText-questions] Images in RTF Files

Javier Martinez

2007-06-14

Replies:

Hello!
 
What I am trying to do is something similar to merge fields with a RTF Template. I need to load a logo into a RTF file depending on the name of a company. The logo is on the header, so I get the RTF code for an image and I replace the tag #LOGO# in the RTF template with the appropiate RTF code.
 
My Java code is like this:
 
String logo = filename;
Image img = Image.getInstance(logo);
RtfDocument doc = new RtfDocument(); 
RtfImage rtfImg = new RtfImage(doc,img);
byte[] image = rtfImg.write();
String str = new String(image);
 
In my project, we use Jasperreports to design reports, and it uses iText-1.3.1.jar library. If I make this with this iText Library version, I can insert the image properly (the only problem is that the image is align to the text). If I use the latest version of the library the string that I obained has a lot of strange characters.
 
I would be grateful if anyone can help me
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
iText-questions mailing list
iText-questions@(protected)
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/
©2008 junlu.com - Jax Systems, LLC, U.S.A.