Skip to content

Instantly share code, notes, and snippets.

How to Convert RTF to HTML using C#. For more information, please follow link: https://kb.conholdate.com/total/net/how-to-convert-rtf-to-html-using-csharp/
using System;
using GroupDocs.Conversion;
using GroupDocs.Conversion.Options.Convert;
namespace ConvertRtfToHtmlUsingCSharp
{
class Program
{
static void Main(string[] args)
{
// Load the RTF file to perfrom RTF to HTML conversion
using (Converter converterRTFFile = new Converter("sample.rtf"))
{
// Use the MarkupConvertOptions class to customize conversion
MarkupConvertOptions RTFToHTMLOptions = new MarkupConvertOptions
{
PageNumber = 2,
PagesCount = 1,
FixedLayout = true
};
// Call the Convert Method to perfrom the RTF to HTML conversion
// This method will output the file to your destination path
converterRTFFile.Convert("converted-rtf.html", RTFToHTMLOptions);
Console.WriteLine("Done");
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment