Hi Sergey,
Been having an issue with tRichView and RTF files containing embedded images. I did a little research and found the problem.
Problem:
TRichView
-RTFReadProperties
when the ExtractMetafileBitmaps property is set to False
the tRichview component will use the original image embedded in the RTF but if the WMF image is missing from the RTF it then fails to retrieve the image (even though it wouldn't use WMF anyway).
This should not be the case, it should still retrieve the original image. For those of us using RTFs with embedded images fixing this would reduce the files size of the RTF files significantly.
Background:
On a PC when you add images to an RTF file, the image gets stored in the RTF file as a WMF, uncompressed. Which cause the file size to jump up dispportionally to the original image size.
You can turn off the creation of the WMF in MS Word by changing a registry value as described here:
Document file size increases with EMF, PNG, GIF, or JPEG graphics in Word
This fixes the bloating problem with images in RTF files but due to the issue mentioned above tRichView has issues.
Other references:
How to reduce size of RTF with embedded images?
Best regards,
Steven
Image bloat in RTF files
-
- Site Admin
- Posts: 17566
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
ExtractMetafileBitmaps affects only reading metafiles. If this property is true and TRichView can extract a bitmap from a metafile, the image is loaded as TBitmap, otherwise it is loaded as TMetafile. In the both cases, the image is loaded.
Normally, MS Word saves raster images in RTF in two alternative representations. The first is a metafile, the second is a png or a jpeg image. If possible, TRichView reads the second image. However, TRichView does not use PNG images by default.
Call RV_RegisterPngGraphic(TPngImage) one time before the first loading
(if you use Delphi 2009+; if you use older version, install TPngObject by Gustavo Huffenbacher Daud from http://www.trichview.com/resources/thir ... gimage.zip and call RV_RegisterPngGraphic(TPngObject).
Normally, MS Word saves raster images in RTF in two alternative representations. The first is a metafile, the second is a png or a jpeg image. If possible, TRichView reads the second image. However, TRichView does not use PNG images by default.
Call RV_RegisterPngGraphic(TPngImage) one time before the first loading
(if you use Delphi 2009+; if you use older version, install TPngObject by Gustavo Huffenbacher Daud from http://www.trichview.com/resources/thir ... gimage.zip and call RV_RegisterPngGraphic(TPngObject).
Ok so you are saying that if the ExtractMetafileBitmaps property is set to False - that it does not load the bitmap but only loads the MetaFile?
The original image, as far as I'm aware, that MS Word is inserting into the RTF is a bitmap. So if I disable MS Word from creating the MetaFile image what format is the image in the RTF?
What I am seeing is that if I disable the WMF from being created in the RTF document that tRichView can not load the image regardless of how the ExtractMetafileBitmaps property is set.
The original image, as far as I'm aware, that MS Word is inserting into the RTF is a bitmap. So if I disable MS Word from creating the MetaFile image what format is the image in the RTF?
What I am seeing is that if I disable the WMF from being created in the RTF document that tRichView can not load the image regardless of how the ExtractMetafileBitmaps property is set.
-
- Site Admin
- Posts: 17566
- Joined: Sat Aug 27, 2005 10:28 am
- Contact: