gitmyhub

PdfSharpCore

C# ★ 0 updated 3y ago ⑂ fork

Port of the PdfSharp library to .NET Core - largely removed GDI+ (only missing GetFontData - which can be replaced with freetype2)

PdfSharpCore is a library that lets you create PDF files programmatically from .NET applications. Instead of manually designing PDFs or using expensive software, you can write code to generate them on the fly — adding text, images, formatting, and more — then save the result as a PDF file.

The library works by giving you drawing tools similar to what you'd use in design software, but accessible through code. You create a document, add pages to it, then use simple commands to place text, set fonts, choose colors, and position elements wherever you want on the page. The example in the README shows how just a handful of lines of code can produce a complete PDF with formatted text. Under the hood, it uses established image and font libraries (SixLabors.ImageSharp and SixLabors.Fonts) to handle the details of rendering, so you don't have to reinvent that wheel.

This project is valuable for developers who need to generate PDFs as part of their application — think invoices, reports, certificates, or any document that needs to be created dynamically. A web application might use it to let users download a formatted receipt; a business tool might generate monthly statements; a backend service might create compliance documents automatically. Anyone building software on .NET who wants to avoid manual PDF creation or expensive third-party PDF engines would find it useful.

The project itself is a modernization effort: it takes the older PdfSharp library and updates it to work with modern .NET (specifically .NET Standard and .NET Core), removing dependencies on older Windows-only graphics libraries. It also ports a companion library called MigraDoc, which adds higher-level document formatting features on top of the core PDF generation. The code is open source under the MIT License, making it free to use and modify.