DocSharp.ImageSharp 0.18.0

dotnet add package DocSharp.ImageSharp --version 0.18.0
                    
NuGet\Install-Package DocSharp.ImageSharp -Version 0.18.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DocSharp.ImageSharp" Version="0.18.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DocSharp.ImageSharp" Version="0.18.0" />
                    
Directory.Packages.props
<PackageReference Include="DocSharp.ImageSharp" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DocSharp.ImageSharp --version 0.18.0
                    
#r "nuget: DocSharp.ImageSharp, 0.18.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DocSharp.ImageSharp@0.18.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DocSharp.ImageSharp&version=0.18.0
                    
Install as a Cake Addin
#tool nuget:?package=DocSharp.ImageSharp&version=0.18.0
                    
Install as a Cake Tool

DocSharp

DocSharp is a pure C# library to convert between document formats without Office interop or native dependencies (except for some special packages, see requirements).

The following packages are currently available:

  • DocSharp.Binary: convert Office 97-2003 binary documents (doc, xls, ppt) to OpenXML documents (docx, xlsx, pptx). This is a fork of the abandoned b2xtranslator project which provides critical fixes.
    Note: pre-97 formats (not documented) and XLSB (very different) are not supported.
  • DocSharp.Docx: convert DOCX to RTF, HTML, Markdown and plain text (.txt), and RTF to DOCX. Possible applications include generating Open XML documents in C# and exporting for other editors/services, or loading Microsoft Word documents in a RichTextBox / RichEditBox control.
  • DocSharp.Markdown: convert Markdown to DOCX or RTF using custom Markdig renderers.
  • DocSharp.Renderer: provides basic DOCX to PDF/images/SVG/XPS conversion using QuestPDF.

Packages can be installed via NuGet:
NuGet NuGet NuGet NuGet NuGet NuGet

The optional extra packages DocSharp.ImageSharp, DocSharp.SystemDrawing, DocSharp.SkiaSharp, DocSharp.MagickNET allow to convert unsupported images (e.g. GIF / TIFF for DOCX → RTF or WMF / EMF / TIFF for DOCX → Markdown/HTML). Each of these has pros and cons, the choice depends on your requirements. More information can be found in the Wiki.

There is no common DOM to manipulate or generate documents, this library is mainly for conversion. Some helper methods on top of the Open XML SDK and format-specific writers are available, but they are mostly intended for internal use; however they could be extended/improved in the future.
You can consider using the Open XML SDK itself or other <a href="#recommended_libraries">recommended libraries</a> for documents creation and manipulation. Some of these are used in the sample app to test two-steps conversions, compare results, or generate documents in multiple formats with the same code.
DocSharp provides methods to accept/return a WordprocessingDocument directly (in addition to file path / Stream / byte array), and a SaveTo extension method for WordprocessingDocument.

Supported features

  • Binary formats: most doc/xls/ppt features were supported by the original project, but exceptions occurred when using .NET (rather than .NET Framework) or loading specific documents. The most noticeable issues have been fixed, but more work is needed to make the library reliable; if you find other bugs, you are welcome to open an issue (please attach a sample file if the issue only occurs for specific documents).
  • DOCX, RTF, Markdown: supported elements vary depending on input and output formats, see Supported features for an overview.

<a id="Requirements"></a>

Requirements

  • Supported targets are .NET 8, 9, 10 and .NET Framework 4.6.2 (minimum netfx version still supported).
  • DocSharp.SystemDrawing is for Windows only (.NET Framework or net*-windows), as System.Drawing.Common is based on GDI+ and only supported on Windows since .NET 6.
  • DocSharp.ImageSharp is cross-platform for .NET 8+, as ImageSharp is fully managed C# code but does not support .NET Framework.
  • DocSharp.MagickNET is cross-platform for both .NET and .NET Framework, but Magick.NET bundles many native libraries that might not work on non-desktop platforms (Android / iOS / WASM)
  • DocSharp.Renderer depends on QuestPDF, which currently supports Windows x64 / x86, macOS x64 / ARM64, Linux x64 / ARM64. Windows ARM64, Android, iOS are not supported yet, due to a custom Skia build. Plus, the XPS generation is only supported on Windows.

Usage

You can refer to the project Wiki or sample apps.

Roadmap

  • Finish and publish experimental converters
  • Support more elements and attributes, and fix issues on edge cases
  • Reduce code duplication, cleanup
  • Async functions/progress callback (some tasks such as downloading images referenced in Markdown may take some time)
  • Improve support for right-to-left and complex script languages
  • Evaluate feasibility of making converters thread-safe and totally NativeAOT-compatible

Credits

Dependencies:

Forked:

Others (credits for parts of the logic, not direct dependencies):

<a id="recommended_libraries"></a> Other recommended libraries (some of these are used in the sample app, not dependencies when installing packages):

License

DocSharp is licensed under MIT license and can be used for both open source and commercial projects.

DocSharp.ImageSharp and DocSharp.MagickNET are licensed under Apache 2.0 license.
ImageSharp has a dual license, please visit their repository for more information. VectSharp is used under LGPL in this project (GPL packages are not used).

DocSharp.Renderer is itself licensed under MIT, but depends on QuestPDF which has additional requirements for companies and may require purchasing a license. Please check their repository for information on the Community and Commercial licenses.

Contribute

  • If you know how to fix a bug, feel free to open a Pull Request.
  • To implement a new feature, please open an issue or discussion to propose it before working on the pull request.
  • If you find the library useful, adding a star is highly appreciated. Stars are a way to guide other developers towards helpful libraries and tools.
  • This is a hobby project. You are welcome to donate to financially support its further development, if you wish (sponsor links for GitHub, LiberaPay, Ko-Fi, BuyMeACoffee and Thanks.dev are available in the repo page).
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.18.0 0 4/6/2026
0.17.0 736 12/4/2025
0.16.0 277 10/26/2025
0.15.0 188 9/12/2025
0.14.0 253 9/2/2025
0.13.1 237 8/31/2025
0.13.0 228 8/29/2025
0.12.0 220 8/13/2025
0.11.0 186 8/9/2025
0.10.0 258 8/4/2025
0.9.0 138 8/1/2025
0.8.5 491 7/25/2025
0.8.4 145 7/18/2025
0.8.3 196 7/18/2025
0.8.2 204 7/17/2025
0.8.1 165 7/13/2025
0.8.0 203 7/10/2025
0.7.1 189 5/23/2025
0.7.0 213 5/18/2025
0.6.0 215 5/6/2025
Loading failed