Hi all, I'm using iText 2.0.6 to generate an RTF file that has to be edited manually afterwards with Word.
The problem is that, after editing, the file size is 10 times bigger
than the original one. Here's a stripped-down example :
public static void main(String[] args) throws Exception {
FileOutputStream fos = new FileOutputStream("C:/Temp/itext/test.rtf");
Document document = new Document();
RtfWriter2.getInstance(document, fos);
Table tableHeader = new Table(1);
tableHeader.setBorder(0);
tableHeader.getDefaultLayout().setBorder(0);
tableHeader.setWidth(100);
tableHeader.addCell(new
Cell(Image.getInstance("C:/Temp/itext/test.jpeg")));
document.setHeader(new RtfHeaderFooter(tableHeader));
document.open();
for (int i = 0; i < 25; i++) {
document.add(new Phrase("Lorem Ipsum "));
document.newPage();
}
document.close();
}
In this example, the Image class is com.lowagie.text.Image, and
test.jpeg is attached to this mail. In case it doesn't make it through
the sourceforge list filter, I got the image from [1].
If you run the example, you'll get a 13Kb file. Open it (I tried with
Word97, Word2000 and OpenOffice.org 2.3), edit the content by adding
just a single character, and save it. You get a 150+ Kb file! And in
our real-life implementation, the original file size is 250 Kb, making
2.5 Mb file after editing.
Adding a String instead of an Image in the header results in a much
smaller generated file of course, but after editing it the file size
is far from growing that much.
I guess it's related to the different ways pictures in headers are
managed in iText and Word, but I wanted to know if there would be some
tweak or parameter I could set with iText to force Word to do it the
"iText-way".
Anyway, thanks again for the great library!
Regards,
alexis
[1] : http://itext.ugent.be/img/lowagie_3d.jpg
<<attachment: test.jpeg>>
------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://itext.ugent.be/itext-in-action/
