READ ME Version 6.0
Information in this document refers to PDFsharp 6.0.0. Links in this document may refer to other pages that have been updated for the latest version of PDFsharp.
What's new
See General for general innovations
See PDFsharp for PDFsharp-specific information
See MigraDoc for MigraDoc-specific information
Prerequisites
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 built 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.
Breaking changes
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.
- An implementation of IFontResolver is required to use any fonts as the Core builds no longer load fonts automatically from the Windows Fonts folder. Use the NuGet packages ending on "-GDI" or "-WPF" if your app runs on Windows only and you want a package that loads fonts from the Windows Fonts folder automatically.
- 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.
More about breaking changes in PDFsharp](../../PDFsharp/Overview/About.md#breaking-changes)
More about breaking changes in MigraDoc](../../MigraDoc/Overview/About.md#breaking-changes)
Assets were 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 https://assets.pdfsharp.com
.
Before you can compile or run projects of a solution go to the dev
folder in the solution root and run download-assets.ps1
once.
This script downloads the assets required by the solution from the web into the assets
folder.
Usage note: We highly recommend opening a console window and going to the root folder of the repository. Then you can see the available scripts using dir dev
and run them directly. To download the assets, you only have to type dev\dow
and then press Tab to have the shell autocomplete the filename. When you type dev\upd
to update local NuGet packages, press Tab until autocomplete gives you the filename you are looking for.
Compile PDFsharp solutions
When you clone a repository like PDFsharp or PDFsharp.Samples from GitHub and download the assets once, it should compile immediately with Visual Studio or dotnet build
.
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 commit to calculate the version number. See Note on using the ZIP file from GitHub.
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.
Running tests
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.