What you need to use PDFsharp.
.NET 6 runtime/SDK for NuGet
To use the NuGet packages .NET 6 is required
.NET 7 SDK for building PDFsharp solutions
PDFsharp is build based on .NET 6 LTS, but we use some C# 11 syntax features that do not require the .NET 7 runtime, e.g. raw string literals.
The most important breaking changes.
- Your project must be .NET 6 or higher. .NET Framework is not supported anymore.
- Rename XFontStyle to XFontStyleEx in your existing PDFsharp projects
XFontStyle changed its meaning.
- The Core builds (NuGet packages PdfSharp and PDFsharp-MigraDoc) no longer use Windows components and can be used under Linux and other platforms.
- The Core builds support common raster image formats. See specifications for details. Supported image formats
- MigraDoc now ignores SpaceBefore for the first paragraph on a page.
- Attempts to modify the DefaultPageSetup may now lead to exceptions.
Assets are removed from repositories
PDFsharp uses a lot of assets like files for images, fonts, or PDFs. Starting with PDFsharp 6 these assets are not
part of the repositories anymore. Instead they are available for download from
Before you can compile or run projects of a solution go to the
dev folder in the solution root and run
This script downloads the assets required by the solution from the web in to the
Compile PDFsharp solutions
Because we use GitVersion to create the semantic version number from a git tag and the current branch name, there may be issues.
- The build may fail because GitVersion does not find a valid tag to calculate the version number. Tag your branch with e.g.
git tag v6.0.0.private.
- Maybe you must commit something at least once. We have this issue sometimes. May be a bug in GitVersion.
There may be other reasons why the build fails.
- A C# file may contain non-ASCII characters and have neither BOM nor UTF-8 encoding. This can happen because our German Windows machines may encode such a file with Western European Codepage 1252 and such a file cannot be opened correctly on e.g. a Chinese Windows machine. Maybe this issue is already fixed in Visual Studio.
Let us know when a solution does not compile immediately.
Run examples under Linux
The PDFsharp solution builds completely under Linux. But obviously only the PDFsharp core examples can be executed. We test it using WSL2 with Ubuntu 20.04 LTS.