MigraDoc in detail

What is MigraDoc?

MigraDoc is a .NET document generator for code-based PDF and RTF document generation.

Create your document on the fly by adding various content elements, like paragraphs, tables, images, sections and more.

How to get MigraDoc

The MigraDoc libraries are available as NuGet packages from NuGet. The source code is also available on GitHub.

See here for more information about the available NuGet packages.

  • Define styles to lay out your document structured and easy to maintain
  • Benefit from automatic text flow, bookmarks and links, fields and generated charts
  • MigraDoc is published under MIT license and free for use with all kinds of projects
  • The library is compatible with .NET and .NET Framework

For more technical details see
MigraDoc introduction in the Technical reference.


Key features

  • Create perfectly laid out documents on the fly
  • Full-featured word processor with automatic text flow
  • Provides styles for structured and easy to maintain layout
  • Re-usable building blocks consisting of text and / or code
  • Integrates easily with existing applications and systems

PDF generation

  • MigraDoc uses PDFsharp to create PDF files
  • You can intercept the PDF creation to modify the resulting PDF files according to your needs, e.g. protection or signatures

Framework-specific features

  • Core build for .NET for all platforms including Windows, Linux, …
  • Core build for .NET Standard for older projects
  • WPF build (Windows Presentation Foundation) with additional Windows features (Windows only)
  • GDI+ build (WinForms) with additional Windows features (Windows only)

Frequently asked questions

Why should I use MigraDoc?

MigraDoc is free and open-source software published under the permissible MIT license.

With PDFsharp you have precise control to draw graphics, text and images on a page, while with MigraDoc you can define a document using an object model. It contains sections, paragraphs, tables, images, and more and is rendered as PDF or RTF. Line breaks, page breaks and all layout calculations are done by MigraDoc.

As a result, you can render sophisticatedly formatted documents with little effort.

On which platforms does MigraDoc run in detail?

Same as PDFsharp MigraDoc can be used with all your .NET and .NET Framework projects.

There are 3 build “flavors” for both .NET and .NET Framework.

The MigraDoc Core build compiled for .NET runs on Windows, Mac, Linux, Docker, Blazor, mobile devices, etc., i.e. it runs everywhere .NET is available.

The MigraDoc Core build compiled for .NET Framework runs on Windows and any platform where .NET Standard 2.0 is supported.

Besides MigraDoc Core, which has no dependencies on Windows, there are two additional builds specialized for Windows: MigraDoc-WPF and MigraDoc-GDI. Both builds are available for both .NET and .NET Framework.

MigraDoc-WPF provides additional functionality for projects based on Windows Presentation Foundation. MigraDoc-GDI provides additional functionality for projects based on WinForms. The main benefits are that you can use GDI+/WPF-specific features for font selection and bitmap image processing. Additionally, both builds provide a preview control.

Can I combine MigraDoc with PDFsharp?

Yes, MigraDoc uses PDFsharp to render a document defined with MigraDoc Document Object Model (MDDOM) to PDF.

You can intercept the rendering process e.g. to protect or encrypt the document or modify each page after it was rendered by MigraDoc.

We e.g. use MigraDoc to create detailed reports that may have several hundred pages, but page backgrounds are added using PDFsharp. This allows us to create reports for different customers, each report complying with the corporate design of the customer. Additionally, both the GDI and WPF builds provide a preview control.

What kind of documents can I create with MigraDoc?

With MigraDoc you can generate reports, invoices, offers, letters and further kinds of documents directly in code. MigraDoc creates sophisticated layouts with paragraphs, tables, images, headers, footers, links, table-of-content, and more and gives you flexibility with respect to design and layout.