Problem with Exporting RadDocument in HTML using HtmlFormatProvider

4 posts, 0 answers
  1. alino
    alino avatar
    22 posts
    Member since:
    Sep 2010

    Posted 13 May 2011 Link to this post

    Hi,

    I have a problem of exporting a RadDocument which has inlineImage. I Created a RadDocument which I use to export in differnt format using different providers. In My RadDocument I have inlineImage i inserted using a MemoryStream containing a PNG Image. When I export in HTML i have only the empty box but without image... Is there any particular settings to make Exporting image correctly in the Html document ??

    Thanks for your precious help.


    Alino
  2. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 18 May 2011 Link to this post

    Hi alino,

    There are HtmlExportSettings that can be used in order to customize the way that images are exported - e.g. inline (encoded) or through their UriSource.
    The default value is Base64Encoded, which for some reason does not work well for images, which are encoded to strings of length larger than 32 KB. (Some browsers do not render the pages, if the size of the image raw data is that big.) Therefore, we have included one other image export mode - Base64EncodedSplit, which you can try if the size of the image is the cause of the misbehavior.
    If that does not help, we would appreciate some more details on your implementation. An outline of the image can also occur when the source of the image is not found or the stream does not contain proper image data.
    I hope that helps.

    All the best,
    Iva
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Chandan
    Chandan avatar
    2 posts
    Member since:
    Apr 2013

    Posted 21 Jan 2014 Link to this post

    Hi Iva,

    I am trying to export content of Rad rich text box using HTML provider.

    I have inserted image in Rad rich text box of size 36 KB.

    Code snippet:

    HtmlExportSettings exportSettings = new HtmlExportSettings();

                HtmlFormatProvider provider = DocumentFormatProvidersManager.GetProviderByExtension("html") as HtmlFormatProvider;

                exportSettings.DocumentExportLevel = DocumentExportLevel.Fragment;

                exportSettings.StylesExportMode = StylesExportMode.Inline;

                exportSettings.ImageExportMode = ImageExportMode.Base64EncodedSplit;

                HtmlDataProvider htmldataprovider = new HtmlDataProvider();

                htmldataprovider.FormatProvider = provider;

                provider.ExportSettings = exportSettings;
             string result = provider.Export(editor.Document);

    when I am trying to send the result as body of email. Image is not getting displayed in outlook.  it is very urgent requirement of my client.

    Thanks

    Chandan



      
  5. Yancho
    Admin
    Yancho avatar
    72 posts

    Posted 24 Jan 2014 Link to this post

    Hi Chandan,

    Indeed, you experienced a security restriction regarding MS Outlook. Most email clients do not show embedded images and this is how RadRichTextBox exports content to HTML. If you try opening the same file in a browser you could verify that it is shown properly.

    However, I would recommend you to handle the export of your image separately. This would avoid any blocking display. If you are going to accomplish this, you have to set the ImageExportMode property of the HtmlExportSettings class to ImageExportingEvent and to subscribe for the ImageExportingEvent. I've attached a small running example to illustrate to you how this could be achieved.

    I hope this helps!

    Regards,
    Yancho
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top