{"id":20982117,"url":"https://github.com/fenphoenix/reasonablertf","last_synced_at":"2026-07-02T00:01:33.315Z","repository":{"id":239506247,"uuid":"799710843","full_name":"FenPhoenix/ReasonableRTF","owner":"FenPhoenix","description":"Convert RTF to plain text 100x faster than RichTextBox.","archived":false,"fork":false,"pushed_at":"2026-06-10T22:45:16.000Z","size":65598,"stargazers_count":6,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-06-10T23:21:04.507Z","etag":null,"topics":["rich-text","rich-text-convertor","rich-text-format","richtext","richtextbox","richtextformat","richtextparse","rtf","rtf-converter","rtf-documents","rtf-files","rtf-to-text"],"latest_commit_sha":null,"homepage":"","language":"Rich Text Format","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FenPhoenix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-05-12T23:46:46.000Z","updated_at":"2026-06-10T22:45:20.000Z","dependencies_parsed_at":"2024-07-07T06:55:33.245Z","dependency_job_id":"5363251c-9b4c-4ed0-87f8-09c3defa85d8","html_url":"https://github.com/FenPhoenix/ReasonableRTF","commit_stats":null,"previous_names":["fenphoenix/reasonablertf"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/FenPhoenix/ReasonableRTF","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FenPhoenix%2FReasonableRTF","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FenPhoenix%2FReasonableRTF/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FenPhoenix%2FReasonableRTF/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FenPhoenix%2FReasonableRTF/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FenPhoenix","download_url":"https://codeload.github.com/FenPhoenix/ReasonableRTF/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FenPhoenix%2FReasonableRTF/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35027341,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-01T02:00:05.325Z","response_time":130,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rich-text","rich-text-convertor","rich-text-format","richtext","richtextbox","richtextformat","richtextparse","rtf","rtf-converter","rtf-documents","rtf-files","rtf-to-text"],"created_at":"2024-11-19T05:44:30.837Z","updated_at":"2026-07-02T00:01:33.303Z","avatar_url":"https://github.com/FenPhoenix.png","language":"Rich Text Format","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ReasonableRTF - Fast RTF to Plain Text Converter 🚀\n\nA lightweight and performant C# library designed for rapidly converting **Rich Text Format (RTF)** files into **plain text**.\n\n- - -\n\n## Features\n\n- Fast: Up to 400x faster than RichTextBox — and over 100x faster at minimum\n- Accurate: All characters converted correctly — even Wingdings\n- Fully cross-platform\n- Can read from forward-only streams such as DeflateStream\n- [We even support this obscure nonsense](https://therealfenphoenix.wordpress.com/2024/01/05/rtf-character-encoding-who-needs-a-spec-anyway/)\n\n- - -\n\n## Installation\n\nInstall the library via NuGet:\n\n```\ndotnet add package ReasonableRTF.Standard\n```\n\n- - -\n\n## Quick Start\n\n### Converting An RTF File\n\nUse the static `ConvertRtf.ToText()` method to do a one-off conversion:\n\n```cs\nusing ReasonableRTF;\nusing ReasonableRTF.Enums;\nusing ReasonableRTF.Models;\n\n// ...\n\nRtfResult result = ConvertRtf.ToText(@\"C:\\rtf_files\\some_file.rtf\");\n\nif (result.Error == RtfError.OK)\n{\n    // Conversion was successful\n    string plainText = result.Text;\n    Console.WriteLine(\"Converted Text:\\n\" + plainText);\n}\nelse\n{\n    // Handle conversion errors\n    Console.WriteLine($\"Conversion Error: {result.Error} at byte position: {result.BytePositionOfError}\");\n    if (result.Exception != null)\n    {\n        Console.WriteLine($\"Exception Details: {result.Exception.Message}\");\n    }\n}\n```\n\n### Converting Many RTF Files Efficiently\n\nYou can create and reuse an `RtfToTextConverter` instance to minimize overhead when converting many files:\n\n```cs\nusing ReasonableRTF;\nusing ReasonableRTF.Enums;\nusing ReasonableRTF.Models;\n\n// ...\n\nRtfToTextConverter converter = new RtfToTextConverter();\nforeach (string fileName in Directory.EnumerateFiles(@\"C:\\rtf_files\\\", \"*.rtf\"))\n{\n    RtfResult result = converter.Convert(fileName);\n    if (result.Error == RtfError.OK)\n    {\n        // Conversion was successful\n        string plainText = result.Text;\n        Console.WriteLine(\"Converted Text:\\n\" + plainText);\n    }\n    else\n    {\n        // Handle conversion errors\n        Console.WriteLine($\"Conversion Error: {result.Error} at byte position: {result.BytePositionOfError}\");\n        if (result.Exception != null)\n        {\n            Console.WriteLine($\"Exception Details: {result.Exception.Message}\");\n        }\n    }\n}\n```\n\nFor efficiency, an `RtfToTextConverter` will not trim its internal growable buffers between conversions. You can use the `ResetMemory()` method to reset these buffers back to their default sizes. This way, you can keep one `RtfToTextConverter` instance around indefinitely without worrying about memory use.\n\n- - -\n\n## The RtfResult Struct\n\nThe `RtfResult` struct provides full details about the conversion process, ensuring you can robustly handle success and failure cases.\n\n| Property | Type | Description |\n| --- | --- | --- |\n| `Text` | `string` | The converted plain text. |\n| `Error` | `RtfError` | The error code. This will be `RtfError.OK` upon successful conversion. |\n| `BytePositionOfError` | `int` | The approximate position in the data stream where the error occurred, or `-1` if no error. |\n| `Exception` | `Exception?` | The caught exception, or `null` if no exception occurred during conversion. |\n\n- - -\n\n## Conversion Options\n\nFor more control over the output, you can provide an instance of the **`RtfToTextConverterOptions`** class.\n\n```cs\nRtfToTextConverterOptions options = new RtfToTextConverterOptions\n{\n    ConvertHiddenText = true,          // Include text marked as hidden\n    LineBreakStyle = LineBreakStyle.LF // Use Unix-style line breaks\n};\n\nRtfResult result = ConvertRtf.ToText(@\"C:\\rtf_files\\some_file.rtf\", options);\n// ... check result\n```\n\nThe available options are documented in [RtfToTextConverterOptions.cs](https://github.com/FenPhoenix/ReasonableRTF/blob/main/ReasonableRTF/Models/RtfToTextConverterOptions.cs).\n\n- - -\n\n## Benchmarks\n\n### .NET 10 64-bit\n\n```\n\nBenchmarkDotNet v0.15.8, Windows 11 (10.0.26200.8655/25H2/2025Update/HudsonValley2)\nAMD Ryzen 5 5600 3.50GHz, 1 CPU, 12 logical and 6 physical cores\n.NET SDK 10.0.301\n  [Host]     : .NET 10.0.9 (10.0.9, 10.0.926.27113), X64 RyuJIT x86-64-v3\n  DefaultJob : .NET 10.0.9 (10.0.9, 10.0.926.27113), X64 RyuJIT x86-64-v3\n\n\n```\n| Method                            | Mean         | Error     | StdDev    | Speed        |          |\n|---------------------------------- |-------------:|----------:|----------:|-------------:|----------|\n| RichTextBox_FullSet               | 3,331.340 ms | 6.2250 ms | 5.5183 ms |   43.59 MB/s | 1x       |\n| RichTextBox_NoImageSet            | 1,432.217 ms | 3.7089 ms | 3.4693 ms |    2.47 MB/s | 1x       |\n| ReasonableRTF_FullSet             |    15.051 ms | 0.0343 ms | 0.0320 ms | 9647.98 MB/s | 221x     |\n| ReasonableRTF_NoImageSet          |     3.372 ms | 0.0055 ms | 0.0046 ms | 1050.91 MB/s | 425x     |\n| ReasonableRTF_FullSet_Streamed    |    16.851 ms | 0.0570 ms | 0.0533 ms | 8617.40 MB/s | 198x     |\n| ReasonableRTF_NoImageSet_Streamed |     3.465 ms | 0.0080 ms | 0.0075 ms | 1022.70 MB/s | 413x     |\n\n### .NET Framework 4.8 64-bit\n\n```\n\nBenchmarkDotNet v0.15.8, Windows 11 (10.0.26200.8655/25H2/2025Update/HudsonValley2)\nAMD Ryzen 5 5600 3.50GHz, 1 CPU, 12 logical and 6 physical cores\n  [Host]     : .NET Framework 4.8.1 (4.8.9337.0), X64 RyuJIT VectorSize=256\n  DefaultJob : .NET Framework 4.8.1 (4.8.9337.0), X64 RyuJIT VectorSize=256\n\n\n```\n| Method                            | Mean         | Error     | StdDev    | Speed        |          |\n|---------------------------------- |-------------:|----------:|----------:|-------------:|----------|\n| RichTextBox_FullSet               | 2,779.775 ms | 3.9318 ms | 3.2833 ms |   52.24 MB/s | 1x       |\n| RichTextBox_NoImageSet            |   992.237 ms | 2.5478 ms | 2.2585 ms |    3.57 MB/s | 1x       |\n| ReasonableRTF_FullSet             |    18.969 ms | 0.0621 ms | 0.0581 ms | 7655.21 MB/s | 147x     |\n| ReasonableRTF_NoImageSet          |     4.686 ms | 0.0122 ms | 0.0108 ms |  756.22 MB/s | 212x     |\n| ReasonableRTF_FullSet_Streamed    |    21.456 ms | 0.0797 ms | 0.0746 ms | 6767.89 MB/s | 130x     |\n| ReasonableRTF_NoImageSet_Streamed |     4.766 ms | 0.0116 ms | 0.0108 ms |  743.53 MB/s | 208x     |\n\n### .NET Framework 4.8 32-bit\n\n```\n\nBenchmarkDotNet v0.15.8, Windows 11 (10.0.26200.8655/25H2/2025Update/HudsonValley2)\nAMD Ryzen 5 5600 3.50GHz, 1 CPU, 12 logical and 6 physical cores\n  [Host]     : .NET Framework 4.8.1 (4.8.9337.0), X86 LegacyJIT\n  DefaultJob : .NET Framework 4.8.1 (4.8.9337.0), X86 LegacyJIT\n\n\n```\n| Method                            | Mean         | Error       | StdDev      | Speed        |          |\n|---------------------------------- |-------------:|------------:|------------:|-------------:|----------|\n| RichTextBox_FullSet               | 6,932.056 ms | 131.6848 ms | 140.9013 ms |   20.95 MB/s | 1x       |\n| RichTextBox_NoImageSet            | 2,885.139 ms |  57.0121 ms |  81.7651 ms |    1.23 MB/s | 1x       |\n| ReasonableRTF_FullSet             |    41.745 ms |   0.1710 ms |   0.1599 ms | 3478.54 MB/s | 166x     |\n| ReasonableRTF_NoImageSet          |     8.240 ms |   0.0178 ms |   0.0158 ms |  430.06 MB/s | 350x     |\n| ReasonableRTF_FullSet_Streamed    |    45.633 ms |   0.0670 ms |   0.0594 ms | 3182.17 MB/s | 152x     |\n| ReasonableRTF_NoImageSet_Streamed |     8.057 ms |   0.0220 ms |   0.0205 ms |  439.82 MB/s | 358x     |\n\n- - -\n\n## Supported RTF features\n\n### Supported\n\n- All basic plain text, hex-encoded chars, Unicode-encoded chars\n- Symbol fonts (Wingdings 1, 2 and 3, Webdings, Symbol, and Zapf Dingbats) converted to Unicode equivalents\n- Characters specified as \"SYMBOL\" field instructions\n- Undocumented use of the \\langN keyword to [specify character encoding](https://therealfenphoenix.wordpress.com/2024/01/05/rtf-character-encoding-who-needs-a-spec-anyway/) - old versions of RichTextBox used to support this\n\n### Partially supported\n\n- Tables: Cells and rows have spaces between them, but not much functionality beyond that.\n- Lists: Numbers and bullets show up (that's better than RichTextBox most of the time), but indentation usually doesn't.\n\n### Not currently supported\n\n- Footnotes\n- \"HYPERLINK\" field instruction value\n- Math objects\n\n- - -\n\n## License and Attribution\n\n### Code License\n\nThe **original code** for this RTF converter was written by **Brian Tobin** and is licensed under the **MIT License** (Copyright 2024-2026 Brian Tobin). For the full license text, please refer to the [LICENSE file ReasonableRTF](https://github.com/FenPhoenix/ReasonableRTF/blob/main/LICENSE).\n\n[Flamifly](https://github.com/Flamifly) contributed to the readme (installation, quick start, documentation, etc), and ported the original .NET-only version to .NET Standard.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffenphoenix%2Freasonablertf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffenphoenix%2Freasonablertf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffenphoenix%2Freasonablertf/lists"}