The example below illustrates how you can convert the HTML of RadEditor to PDF format using an HTML2PDF convertor tool of Tall Components. For a live demo, please go to http://www.tallcomponents.com/cp0803.aspx

 

ASPX code

<form id=”Form1″ method=”post” runat=”server”>
    RadEditor id=”RadEditor1″ Runat=”server”>
    <asp:button id=”showPDF” runat=”server” Text=”Show PDF”></asp:button>

C# code

private void showPDF_Click(object sender, EventArgs e)
{
    string html = “<html>” + RadEditor1.Html + “</html>”;
    TallComponents.PDF.Layout.Document document = new TallComponents.PDF.Layout.Document();
    TallComponents.PDF.Layout.Section section = document.Sections.Add();
    TallComponents.PDF.Layout.HtmlParagraph htmlParagraph = new TallComponents.PDF.Layout.HtmlParagraph();
    htmlParagraph.FontPath = “fonts“;
    htmlParagraph.Text = html;
    section.Paragraphs.Add( htmlParagraph );
    Response.Clear();
    document.Write( Response );
    Response.End();
}

VB.NET code

Private Sub showPDF_Click(ByVal sender As Object, ByVal e As EventArgs)
 Dim html As String = “<html>” + RadEditor1.Html + “</html>”
 Dim document As TallComponents.PDF.Layout.Document = New TallComponents.PDF.Layout.Document
 Dim section As TallComponents.PDF.Layout.Section = document.Sections.Add
 Dim htmlParagraph As TallComponents.PDF.Layout.HtmlParagraph = New TallComponents.PDF.Layout.HtmlParagraph
 htmlParagraph.FontPath = “fonts”
 htmlParagraph.Text = html
 section.Paragraphs.Add(htmlParagraph)
 Response.Clear
 document.Write(Response)
 Response.End
End Sub

ASPX code

<form id=”Form1″ method=”post” runat=”server”>
    ScriptManager ID=”ScriptManager1″ runat=”server” />
    <telerik:RadEditor id=”RadEditor1″ Runat=”server”>
    <asp:button id=”showPDF” runat=”server” Text=”Show PDF”></asp:button>
</form>

C# code

private void showPDF_Click(object sender, EventArgs e)
{
    string html = “<html>” + RadEditor1.Content + “</html>”;
    TallComponents.PDF.Layout.Document document = new TallComponents.PDF.Layout.Document();
    TallComponents.PDF.Layout.Section section = document.Sections.Add();
    TallComponents.PDF.Layout.HtmlParagraph htmlParagraph = new TallComponents.PDF.Layout.HtmlParagraph();
    htmlParagraph.FontPath = “fonts”;
    htmlParagraph.Text = html;
    section.Paragraphs.Add( htmlParagraph );
    Response.Clear();
    document.Write( Response );
    Response.End();
}

VB.NET code

Private Sub showPDF_Click(ByVal sender As Object, ByVal e As EventArgs)
 Dim html As String = “<html>” + RadEditor1.Content+ “</html>”
 Dim document As TallComponents.PDF.Layout.Document = New TallComponents.PDF.Layout.Document
 Dim section As TallComponents.PDF.Layout.Section = document.Sections.Add
 Dim htmlParagraph As TallComponents.PDF.Layout.HtmlParagraph = New TallComponents.PDF.Layout.HtmlParagraph
 htmlParagraph.FontPath = “fonts”
 htmlParagraph.Text = html
 section.Paragraphs.Add(htmlParagraph)
 Response.Clear
 document.Write(Response)
 Response.End
End Sub

In the “Article Files” section, there is attached a sample project with RadEditor 6.1 demonstrating the described functionality.

Article Links

Advertisements
Comments
  1. Victoria secret credit card says:

    Thanks for some other great article. Where else may just anyone get that type of information in such an ideal approach of writing? I’ve a presentation subsequent week, and I am on the look for such information.

    Like

  2. Florida resorts says:

    My brother suggested I may like this website. He used to be totally right. This post actually made my day. You cann’t believe simply how a lot time I had spent for this info! Thanks!

    Like

  3. Hai Akhtar,
    I’m Raghavendra joined as a DOTNET Developer(ASP) in Visakhapatnam. I have a problem with one of the module which is assigned to me.
    In this module we have a list of templates in which our ADMIN selects one of the template and uses it for editing to send it as a Email invitation to his registered clients. For editing purpose i’m using a RADEDITOR component.
    1. But in this images are not loading dynamically based on the selection from previous webpage.
    2. Secondly how to insert an html code dynamically whenever i select an image inside a Content tag.

    My code is as follows

    RadEditor for ASP.NET AJAX
    RadEditor is not simply an HTML1 Editor. It is what Microsoft chose to use in MSDN, CodePlex, TechNet, MCMS and even as an alternative to the default editor in SharePoint. Whether you need a mere Textbox with Google-like spellchecker, or a Word-like content authoring environment, the result is the same: clean XHTML output, fast rendering, widest cross-browser support, and tons of features:

    Out-of-the-box XHTML-enabled Output…

    Unmatched Loading Speed and Performance

    Microsoft Word-like Spell-checking

    Seven Ways for Pasting from Word

    Multilevel Undo/Redo with Action Trails

    Extended Functionality Through Integrated Controls

    So instead of writing entire code inside the content tag is there any way to generate HTML code dynamically and use it for editing???

    Like

    • dear as you know that in email, html is allowed but first you have to made it in the sample .html page then run that .html page in the browser now your html in the visual form now select that visual and past in the email body as it is .and in this way your html is in visual form included in email.
      now you want to html is generated in the run time for that you have to make inline styling like that

      e.g
      String var=””;
      String body=””;
      in this u can use html tags okz
      var=”tag+” hi dear “+” tag “+ body +”tag” +”tag”; and etc…………………….

      in then send that “var” …….. now in the visual form u can send mail …….

      Like

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s