Hi,

it is basically like Howard explained, every writer can decide which optional 
tags (and a lot are optional) to output. Word is very verbose, mainly because 
RTF represents all the options that you can select in Word and Word writes 
them out, even if they are the defaults. Also Word writes compatibility tags, 
which take further space.

And there is nothing you can do about it. Sorry.

Greetings,
Mark

On Thursday 15 November 2007, Alexis Pigeon wrote:
> 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



-- 
Q:      What do you get when you cross a mobster with an international standard?
A:      You get someone who makes you an offer that you can't understand!

My GPG public key is available at:
http://www.room3b.eu/data_box/download?path=%2Fsecurity%2FMarkHall.asc

Attachment: signature.asc
Description: This is a digitally signed message part.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
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/

Reply via email to