We are frequently asked why the filesize of documents containing images (BMP and WMF) grows when they are exported to Microsoft Word or RTF formats.
The answer is quite simple:
Images might be exported as a BMP or WMF files, which are typically built from uncompressed data.
Reducing the filesize of documents containing images is equally simple:
TX Text Control .NET supports image export to external files, using compressed formats, such as JPG or PNG. Developers often are not aware that the image format can be also specified, if the images are embedded in the document itself.
The SaveMode property of the Image class specifies whether the image should be exported or embedded in the document.
The ExportFilterIndex, on the other hand, specifies the format of the image. Possible formats are: BMP, WMF, PNG or JPG.
In the following VB.NET sample, the resulting document size clearly demonstrates the effect of setting an appropriate image format:
BMP -> 151 KBWMF -> 53 KBPNG -> 56 KBJPG -> 13 KB
The sample shows how to change every image format in a document. The ComboBox receives all image formats from the Images.ExportFilters property.
For Each image As TXTextControl.Image In TextControl1.Images
image.ExportFilterIndex = ComboBox1.SelectedIndex + 1
image.SaveMode = TXTextControl.ImageSaveMode.SaveAsData
Next
Dim fileFormatIndex As String = ComboBox1.SelectedIndex + 1
TextControl1.Save("test_" + fileFormatIndex + ".rtf", TXTextControl.
StreamType.RichTextFormat)Are you going to support inline image data anytime soon? Here's an example: http://scott.connerly.net/sideload/inline.html
It works on Moz but not IE or TX Text Control right now.Very interesting question. I am going to discuss this with our developer team.Any thoughts yet on supporting this? I know the company that I work for (that already subscribes to TX) would have great use
for it. I would restrain from identifying my company, as this is not an 'official' posting...I discussed this feature with our HTML filter specialists. We are going to consider that with special regard to the new trojans
and viruses in JPG images. IMHO, this is a very sensitive way to include images in an HTML document.In case you wanted the RFC's on this protocol, here you go:
http://www.ietf.org/rfc/rfc2557.txt
http://www.faqs.org/rfcs/rfc2397.html
Thank you for considering including this.Question, maybe silly for you but why in any place of the documentation of your control there is not a list of the
ExportFilterIndex values and their meaning?
I've found a thread on an error and in that thread such as in this post it is indicated that the above property can be used to
avoid problems.
Now I've found it can be set to 3 but what means 3 BMP?JPG?WMF?PNG?TIF?
In the documentation in the CHM and also in the online documentation the property is described but there is not a reference
table.
This property as many others in your control is an integer, why not use an Enum???
Sorry but I'm a little bit frustrated because I'm not able to save and reload a document with images from your control and I
have a demo tomorrow morning, if you can let know to the people who writes the documentation that the admissible values for the
enumerated properties would be a helpful addin to the property definition it would be very kind.
SabrinaHey,
I've noticed Scott's question from Apr 2005 regarding inline image data for HTML format.
My company is in the process of finding a solution like TX Text Control offers and this feature - inline image data for HTML
format - stands as a central requirement.
Is this feature included in the latest TX Text Control .NET for WinForms? If not - can we expect it in the near future?
Thanks,
IgalHello
Quick note: TX Text Control 15.0 now supports embedded images in HTML in all versions.