Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

ifmelate/Html2OpenRtf

Open more actions menu

Repository files navigation

Html2OpenRtf

Free, open-source .NET library for converting HTML to RTF (Rich Text Format).

Build NuGet License: MIT

Installation

dotnet add package Html2OpenRtf

Usage

using Html2OpenRtf;

// HTML string to RTF string
string rtf = HtmlToRtfConverter.ConvertHtmlToRtf("<p>Hello <b>World</b></p>");

// HTML to RTF bytes (ASCII)
byte[] rtfBytes = HtmlToRtfConverter.ConvertHtmlToRtfBytes(html);

// HTML to Base64-encoded RTF (useful for APIs)
string base64Rtf = HtmlToRtfConverter.ConvertHtmlToBase64Rtf(html);

Supported HTML

Category Tags
Block p, div, br, h1-h6, blockquote, hr, pre
Inline b/strong, i/em, u, s/strike/del, sub, sup
Lists ul, ol, li (including nested)
Tables table, tr, td, th (equal-width cells)
Links a (clickable RTF hyperlinks)
Images img (placeholder [image: alt])
Code code, kbd, samp (monospace font)
Highlight mark (yellow background)
Styles color, font-size, background-color, text-align, font-weight, font-style, text-decoration via style attribute
Unicode Full support (Cyrillic, CJK, etc. via \uN? escapes)
Entities Full HTML entity decoding

Target

  • .NET Standard 2.0 (compatible with .NET Framework 4.6.1+, .NET Core 2.0+, .NET 5-9)
  • Single dependency: HtmlAgilityPack (MIT)
  • Cross-platform: Windows, Linux, macOS

Contributing

PRs welcome. Run tests with:

dotnet test

License

MIT

About

Free, open-source HTML to RTF converter for .NET

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.