Completed
Last Updated: 17 Aug 2020 15:12 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 23 Apr 2018 07:55
Category: RichTextEditor
Type: Bug Report
2
FIX. RadRichTextEditor - exception is thrown when exporting an HTML document to pdf
When you load a HTML file where the image is not loaded properly and you try to export RadRichTextEditor's document to a pdf, an error occurs. 

Workaround:
If the image doesn't exist you can skip loading in the document. Thus, exporting to pod at a later moment won't produce an error. You can use the HtmlImportSettings.LoadImageFromUrl event and handle the image loading:

    Sub New()

        ' This call is required by the designer.
        InitializeComponent()

        Dim provider As HtmlFormatProvider = New HtmlFormatProvider()

        Dim htmlImportSettings As HtmlImportSettings = New HtmlImportSettings() 
        AddHandler htmlImportSettings.LoadImageFromUrl, AddressOf LoadImageFromUrl
        provider.ImportSettings = htmlImportSettings

        Using inputStream As FileStream = File.OpenRead("..\..\Email HTML.html")
            Me.RadRichTextEditor1.Document = provider.Import(inputStream)
        End Using

    End Sub

    Private Sub LoadImageFromUrl(sender As Object, e As LoadImageEventArgs)
        e.Handled = True
    End Sub
0 comments