Mavusi.PdfSharpCore 2.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Mavusi.PdfSharpCore --version 2.0.0
                    
NuGet\Install-Package Mavusi.PdfSharpCore -Version 2.0.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="Mavusi.PdfSharpCore" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Mavusi.PdfSharpCore" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Mavusi.PdfSharpCore" />
                    
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 Mavusi.PdfSharpCore --version 2.0.0
                    
#r "nuget: Mavusi.PdfSharpCore, 2.0.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 Mavusi.PdfSharpCore@2.0.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=Mavusi.PdfSharpCore&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Mavusi.PdfSharpCore&version=2.0.0
                    
Install as a Cake Tool

PdfSharpCore (forked)

NuGet Version CI codecov.io

PdfSharpCore (forked by Mavusi) is a partial port of PdfSharp.Xamarin for .NET Standard. Additionally MigraDoc has been ported as well (from version 1.32). Native image support has been implemented for JPEG, PNG, and BMP formats without external dependencies. Font support provided by SixLabors.Fonts.

Original project by ststeiger → https://github.com/ststeiger/PdfSharpCore.

This fork added:

  • Native image processing (JPEG, PNG, BMP) - no ImageSharp dependency required
  • Lesser "accuracy level" (Pdf.IO.enums.PdfReadAccuracy.Lazy) for opening some broken PDFs
  • Preliminary support for PDF Signatures validation (PdfDocument.IsSigned, PdfDocument.Signatures)

Table of Contents

Example

The following code snippet creates a simple PDF-file with the text 'Hello World!'. The code is written for a .NET 6 console app with top level statements.

using PdfSharpCore.Drawing;
using PdfSharpCore.Fonts;
using PdfSharpCore.Pdf;
using PdfSharpCore.Utils;

GlobalFontSettings.FontResolver = new FontResolver();

var document = new PdfDocument();
var page = document.AddPage();

var gfx = XGraphics.FromPdfPage(page);
var font = new XFont("Arial", 20, XFontStyle.Bold);

var textColor = XBrushes.Black;
var layout = new XRect(20, 20, page.Width, page.Height);
var format = XStringFormats.Center;

gfx.DrawString("Hello World!", font, textColor, layout, format);

document.Save("helloworld.pdf");

Publishing to NuGet

This package supports .NET 8, .NET 9, and .NET 10 through multi-targeting.

Before Publishing

  1. Update Version Numbers

    Before publishing a new version, update the version in all project files:

    • PdfSharpCore/Moondigo.PdfSharpCore.csproj
    • PdfSharpCore.Charting/PdfSharpCore.Charting.csproj
    • MigraDocCore.DocumentObjectModel/MigraDocCore.DocumentObjectModel.csproj
    • MigraDocCore.Rendering/MigraDocCore.Rendering.csproj

    Update the following properties:

    <Version>1.0.1</Version>
    <AssemblyVersion>1.0.1.0</AssemblyVersion>
    <FileVersion>1.0.1.0</FileVersion>
    

    Note: Follow Semantic Versioning:

    • MAJOR version for incompatible API changes
    • MINOR version for new functionality in a backward compatible manner
    • PATCH version for backward compatible bug fixes
  2. Update Release Notes (optional but recommended)

    Update the <PackageReleaseNotes> property in each project file to describe what's new in this version.

Publishing Steps

  1. Clean and Build in Release Mode

    dotnet clean
    dotnet build -c Release
    
  2. Create NuGet Packages

    Packages are automatically created during build (when GeneratePackageOnBuild is True). Find them in:

    • PdfSharpCore/bin/Release/
    • PdfSharpCore.Charting/bin/Release/
    • MigraDocCore.DocumentObjectModel/bin/Release/
    • MigraDocCore.Rendering/bin/Release/

    Alternatively, manually pack:

    dotnet pack -c Release
    
  3. Publish to NuGet

    Quick Publish (One Command)

    Copy and paste this command to build and publish all packages at once:

    $apiKey = "YOUR_API_KEY_HERE"; dotnet clean; dotnet build -c Release; Get-ChildItem -Path . -Recurse -Filter "*.nupkg" | Where-Object { $_.FullName -like "*\bin\Release\*" } | ForEach-Object { dotnet nuget push $_.FullName --source https://api.nuget.org/v3/index.json --api-key $apiKey --skip-duplicate }
    

    Or publish using wildcards:

    # Navigate to each project's Release folder or use wildcards
    dotnet nuget push "**/*.nupkg" --source https://api.nuget.org/v3/index.json --api-key YOUR_API_KEY_HERE --skip-duplicate
    

    Or publish each package individually:

    dotnet nuget push PdfSharpCore/bin/Release/Mavusi.PdfSharpCore.1.0.1.nupkg -s https://api.nuget.org/v3/index.json -k YOUR_API_KEY_HERE
    

    Note: Get your NuGet API key from https://www.nuget.org/account/apikeys

  4. Verify Publication

    After publishing, verify your package appears at:

Multi-Targeting Support

The NuGet package includes binaries for:

  • net8.0
  • net9.0
  • net10.0

NuGet will automatically select the appropriate target framework based on the consuming project's target framework.

Contributing

We appreciate feedback and contribution to this repo!

License

This software is released under the MIT License. See the LICENSE file for more info.

PdfSharpCore relies on the following projects:

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 (1)

Showing the top 1 NuGet packages that depend on Mavusi.PdfSharpCore:

Package Downloads
Mavusi.HtmlRendererCore.PdfSharp

HtmlRendererCore is a partial port of HtmlRenderer for .NET Core. Supports rendering HTML to PDF using PdfSharp on .NET 8, 9, and 10. Includes bundled Liberation Fonts for Docker and cloud environments - no system fonts required! Lightweight with minimal dependencies - no ImageSharp required.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.2 97 4/16/2026
2.0.1 102 4/16/2026
2.0.0 181 4/15/2026
1.0.0 3,398 8/18/2025

PdfSharpCore (forked by Mavusi) is a partial port of PdfSharp.Xamarin for .NET Core. Removed ImageSharp and SharpZipLib dependencies