Last active
May 30, 2022 13:37
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/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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