Convert RTF File to HTML File using SautinSoft.RtfToHtml.dll DLL in ASP.NET

Step 1: Download SautinSoft.RtfToHtml.dll DLL from given link

http://downloads.zdnet.com/product/2066-10708032/

Step 2: Add reference to SautinSoft.RtfToHtml.dl as ur version

Step 3: Add namespace

using SautinSoft;
using System.IO;

Step 4: write below code on button click event write the code.

protected void Button1_Click(object sender, EventArgs e)

{

    SautinSoft.RtfToHtml r = new SautinSoft.RtfToHtml();

    r.OutputFormat = SautinSoft.RtfToHtml.eOutputFormat.HTML_401;

    r.ImageStyle.IncludeImageInHtml = false; //To save images inside HTML as binary data specify this property to 'true'

    r.ImageStyle.ImageFolder = Server.MapPath("");

    r.ImageStyle.ImageSubFolder = "images";

    r.ImageStyle.ImageFileName = "picture";

     string rtf = File.ReadAllText(@"C:\Documents\633868836830039716_d50a2ee6-4dad-4911-aaa8-692b24ed8734.rtf");

    string html = r.ConvertString(rtf);

    //show HTML

    if (html.Length > 0)

    {

        File.WriteAllText(@"C:\myfile.html", html);

    }

}

Ebook Download
View all
Learn
View all