Page 1 of 1

file size with rtf

Posted: Thu May 17, 2007 10:59 am
by PKH
My program lets the user generate a report with numerous embedded data charts (generated using a TeeChartPro component). The rtf file size is 2.5MB. If I paste the entire document from the TRichView component into Microsoft Word and save as a .doc file the file size is less than 100KB. My client is complaining about the rtf file size. How can I reduce it?

Posted: Thu May 17, 2007 3:17 pm
by Sergey Tkachenko
If these charts do not have gradients or textured backgrounds, save them in metafiles instead of bitmaps. It will give you much higher printing quality and small file size.

If you still need to use bitmaps, you can convert them to PNG (using http://pngdelphi.sourceforge.net/ ):

Code: Select all

png := TPNGObject.Create;
png.Assign(bmp);
bmp.Free;
RichView.AddPictureEx(..., png, ...).
Call RV_RegisterPngGraphic(TPngObject), and PNG will be saved to RTF as PNG. They have MUCH smaller size than bitmaps.

In the latest version (RichView v1.9.41) available for registered users, there are two new options for reducing RTF file size:
One of them allows saving bitmaps as PNG.
Another one allows saving pictures in RTF in binary mode (twice less in size, but RTF becomes a binary file).