Saving Html to RTF with image fails

Last post 03-31-2009, 1:51 PM by Adam. 7 replies.
Sort Posts: Previous Next
  •  03-25-2009, 3:33 PM 50278

    Saving Html to RTF with image fails

    I am using CuteEditor to allow clients to create letters.  Those letters are saved to our database in HTML and RTF format.  I am using the Convertor class to convert the HTML to RTF before I save it to the database.
     
    This works fine as long as the letter does not contain an image. If an image is added to the letter the following error occurs when trying to convert to RTF:
     
    Invalid URI: The format of the URI could not be determined.
     
    The line of code that this error occurs on is:
     
    CuteEditor.Convertor.RTF.HTML2RTF convertor = new CuteEditor.Convertor.RTF.HTML2RTF(Editor1.Text);
     
    Any help on this would be appreciated as I would like my clients to be able to add images to the letters.  We definitely need to save in both HTML and RTF format due to some back end processes the letters run through.
     
    Thanks!
  •  03-25-2009, 8:33 PM 50288 in reply to 50278

    Re: Saving Html to RTF with image fails

  •  03-26-2009, 8:01 AM 50303 in reply to 50288

    Re: Saving Html to RTF with image fails

    Thanks!  I tried that and now I get a "Parameter is not valid" error, see below:
     

    Error message: Parameter is not valid.

    Source: lettertemplateeditor

    Stack trace:

    • System.Drawing.Image.FromStream(Stream stream, Boolean useEmbeddedColorManagement, Boolean validateImageData)
    • System.Drawing.Image.FromStream(Stream stream)
    • CuteEditor.Convertor.RTF.RTFImageHelper.LoadFromHtml(HTMLNode imgNode, String baseUrl)
    • CuteEditor.Convertor.RTF.HTML2RTF.a(HTMLNode A_0, FontStyle A_1, Int32& A_2)
    • CuteEditor.Convertor.RTF.HTML2RTF.a(HTMLNode A_0, FontStyle A_1, Int32& A_2)
    • CuteEditor.Convertor.RTF.HTML2RTF.a(HTMLNode A_0, FontStyle A_1, Int32& A_2)
    • CuteEditor.Convertor.RTF.HTML2RTF.a(HTMLNode A_0, FontStyle A_1, Int32& A_2)
    • CuteEditor.Convertor.RTF.HTML2RTF.a(HTMLNode A_0, FontStyle A_1, Int32& A_2)
    • CuteEditor.Convertor.RTF.HTML2RTF.f()
    • CuteEditor.Convertor.RTF.HTML2RTF..ctor(String html)
    • DealersCircleWeb.LetterTemplateEditor.btnSave_Click(Object sender, EventArgs e)
  •  03-26-2009, 2:13 PM 50323 in reply to 50303

    Re: Saving Html to RTF with image fails

    Please try the following code:
     
    1. <%@ Page Language="C#"%>   
    2. <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>   
    3.   
    4. <script runat="server">   
    5.     void Page_Load(object sender, System.EventArgs e)   
    6.      {   
    7.         if (!IsPostBack)    
    8.         {    
    9.             Editor1.Text="Type here";   
    10.         }      
    11.     }   
    12.     public void Submit(object sender, System.EventArgs e)   
    13.     {   
    14.             Editor1.SaveRTF("document.rtf");   
    15.             textbox1.Text = Editor1.Text;    
    16.     }   
    17. </script>   
    18. <html>   
    19.     <head>   
    20.         <title>RTF to HTML, HTML to RTF</title>   
    21.     </head>   
    22.     <body>   
    23.         <form id="Form1" runat="server">   
    24.             <CE:Editor id="Editor1" URLType="Absolute" AutoConfigure="Simple" runat="server" ></CE:Editor>   
    25.             <br />   
    26.             <br />   
    27.             <asp:Button id="btnUpdate" onclick="Submit" Runat="server" Text="Submit"></asp:Button>                         
    28.             <br />   
    29.             <asp:textbox id="textbox1" runat="server" TextMode="MultiLine" Height="250px" Width="730px"></asp:TextBox>         
    30.         </form>   
    31.     </body>   
    32. </html>  

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  03-27-2009, 1:30 PM 50380 in reply to 50323

    Re: Saving Html to RTF with image fails

    I created a new page with the above code and I get the same Parameter is Invalid error:
     

    Parameter is not valid.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.ArgumentException: Parameter is not valid.

    Source Error:

    Line 12:     public void Submit(object sender, System.EventArgs e)   
    Line 13:     {   
    Line 14:             Editor1.SaveRTF("document.rtf");   
    Line 15:             textbox1.Text = Editor1.Text;    
    Line 16:     }   

    Source File: c:\Development\DealersCircle\DealersCircleWeb\WebForm1.aspx    Line: 14

    Stack Trace:

    [ArgumentException: Parameter is not valid.]
       System.Drawing.Image.FromStream(Stream stream, Boolean useEmbeddedColorManagement, Boolean validateImageData) +1062843
       System.Drawing.Image.FromStream(Stream stream) +8
       CuteEditor.Convertor.RTF.RTFImageHelper.LoadFromHtml(HTMLNode imgNode, String baseUrl) +348
       CuteEditor.Convertor.RTF.HTML2RTF.a(HTMLNode A_0, FontStyle A_1, Int32& A_2) +2122
       CuteEditor.Convertor.RTF.HTML2RTF.a(HTMLNode A_0, FontStyle A_1, Int32& A_2) +2338
       CuteEditor.Convertor.RTF.HTML2RTF.a(HTMLNode A_0, FontStyle A_1, Int32& A_2) +2338
       CuteEditor.Convertor.RTF.HTML2RTF.a(HTMLNode A_0, FontStyle A_1, Int32& A_2) +2338
       CuteEditor.Convertor.RTF.HTML2RTF.f() +437
       CuteEditor.Convertor.RTF.HTML2RTF..ctor(String html) +586
       CuteEditor.Editor.SaveRTF(String path) +103
       ASP.webform1_aspx.Submit(Object sender, EventArgs e) in c:\Development\DealersCircle\DealersCircleWeb\WebForm1.aspx:14
       System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
       System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
       System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
       System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
       System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
    
  •  03-30-2009, 2:21 PM 50473 in reply to 50380

    Re: Saving Html to RTF with image fails

    Adam,
     
    Thanks for the help thus far.  Have you had a chance to think about this one further?  I'm waiting on the outcome of this issue to purchase a license.
     
    Thank You!
  •  03-31-2009, 1:24 PM 50543 in reply to 50473

    Re: Saving Html to RTF with image fails

    Can anyone help with this or point me in the direction of another venue for pre-sales support?
     
    Thank You!
  •  03-31-2009, 1:51 PM 50551 in reply to 50380

    Re: Saving Html to RTF with image fails

    I have no clue about this example doesn't work for you.
     
    Is your site online?
     
    If so, can you set up FTP access and send it to me?

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

View as RSS news feed in XML