PDFsharp PDF Creator & Producer
Understanding PDF metadata that shows PDFsharp as the Creator or Producer โ learn how the open-source .NET library creates and processes PDF documents using GDI+ style drawing routines.
๐ About This PDF Metadata
When you examine a PDF file's properties and see PDFsharp followed by version information as the Producer, it indicates that the document was created or modified using the PDFsharp .NET library developed by empira Software GmbH.
Sample PDF Metadata from PDFsharp:
Title: Invoice Report
Author: John Smith
Creator: PDFsharp 6.1.1 (www.pdfsharp.net)
Producer: PDFsharp 6.1.1 (www.pdfsharp.net)
Creation Date: 2025-01-27 10:30:00
PDF Version: 1.4
PDFsharp automatically sets the Producer field to include its name, version, and URL. If the Creator field is empty, PDFsharp also sets it to the same value. This metadata helps identify that the PDF was generated using the PDFsharp library.
PDF Creator
Shows PDFsharp [version] (www.pdfsharp.net) when creating new documents. Can be customized via document.Info.Creator property.
PDF Producer
Always shows PDFsharp [version] (www.pdfsharp.net) โ this is automatically set by the library and cannot be changed through normal API methods.
๐ What is PDFsharp?
PDFsharp is an open-source .NET library for creating and processing PDF documents. Developed by empira Software GmbH in Germany since 2005, PDFsharp allows developers to create PDF pages using drawing routines similar to GDI+ (Graphics Device Interface). With over 40 million NuGet downloads, it's one of the most popular PDF libraries for .NET.
Project Information
| First Released: | 2005 |
| Developer: | empira Software GmbH |
| Location: | Troisdorf (Cologne Area), Germany |
| License: | MIT (Open Source) |
| Website: | pdfsharp.net |
Technical Details
| Written in: | C# |
| Current Version: | 6.x series |
| Platforms: | .NET 6/8, .NET Framework 4.x |
| NuGet Downloads: | 40+ million |
| Authors: | Stefan Lange, Thomas Hรถvel |
Key Features:
GDI+ Style Drawing
Draw graphics, text, and images using familiar GDI+ drawing routines
Merge & Split
Combine multiple PDFs or extract pages into separate documents
Cross-Platform
Runs on Windows, Linux, and Mac with .NET 6/8
๐ก PDFsharp vs MigraDoc
PDFsharp is for low-level PDF creation where you control exact positioning. MigraDoc (also from empira) is a document model with automatic layout, page breaks, paragraphs, tables, and styles. MigraDoc uses PDFsharp internally to render to PDF.
โ๏ธ How PDFsharp Creates PDFs
PDFsharp creates PDF documents programmatically using an object model similar to GDI+ graphics programming. You create a document, add pages, and use drawing commands to place content.
PDFsharp Workflow:
Creating PDFs
- PdfDocument: Create new or open existing PDF
- PdfPage: Add pages with custom sizes
- XGraphics: Drawing context for content
- XFont/XBrush: Text and fill formatting
PDF Operations
- Merge: Combine multiple PDF files
- Split: Extract pages to new documents
- Modify: Edit existing PDF pages
- Secure: Add encryption and passwords
The same drawing code can target PDF output, screen display (via WPF or WinForms), or a printer โ making it easy to create WYSIWYG applications.
๐ค How to Use PDFsharp
Install PDFsharp via NuGet and start creating PDFs:
Install via NuGet:
# Package Manager Console
Install-Package PDFsharp
# .NET CLI
dotnet add package PDFsharp
Create a Simple PDF:
using PdfSharp.Pdf;
using PdfSharp.Drawing;
// Create a new PDF document
PdfDocument document = new PdfDocument();
document.Info.Title = "My First PDF";
// Add a page
PdfPage page = document.AddPage();
XGraphics gfx = XGraphics.FromPdfPage(page);
// Draw text
XFont font = new XFont("Arial", 20);
gfx.DrawString("Hello, PDFsharp!", font,
XBrushes.Black, 100, 100);
// Save the document
document.Save("output.pdf");
Merge Multiple PDFs:
using PdfSharp.Pdf;
using PdfSharp.Pdf.IO;
// Open input files
PdfDocument input1 = PdfReader.Open("file1.pdf",
PdfDocumentOpenMode.Import);
PdfDocument input2 = PdfReader.Open("file2.pdf",
PdfDocumentOpenMode.Import);
// Create output document
PdfDocument output = new PdfDocument();
// Copy pages from input files
foreach (PdfPage page in input1.Pages)
output.AddPage(page);
foreach (PdfPage page in input2.Pages)
output.AddPage(page);
output.Save("merged.pdf");
Set Document Metadata:
PdfDocument document = new PdfDocument();
// Set document information
document.Info.Title = "Annual Report 2025";
document.Info.Author = "Jane Doe";
document.Info.Subject = "Financial Summary";
document.Info.Keywords = "finance, report, 2025";
document.Info.Creator = "My Application";
// Note: Producer is set automatically by PDFsharp
๐ง Features & Capabilities
PDFsharp provides comprehensive PDF creation and manipulation features:
Graphics & Drawing
- Lines, curves, rectangles, ellipses
- Bรฉzier curves and paths
- Clipping regions
- Transformations (rotate, scale, translate)
- Transparency and alpha channels
- Color spaces (RGB, CMYK, Grayscale)
Text & Fonts
- TrueType and OpenType fonts
- Font embedding and subsetting
- Unicode support
- Text measurement (MeasureString)
- Text alignment and formatting
- Basic text layout
Images
- PNG, JPEG, GIF, TIFF, BMP formats
- Transparency (alpha mask, color mask)
- Image scaling and positioning
- XPS to PDF conversion
- PDF form XObjects
Document Operations
- Create new PDF documents
- Modify existing PDFs
- Merge multiple PDFs
- Split PDFs into pages
- PDF encryption (40-bit, 128-bit)
- Annotations (text, links, stamps)
NuGet Packages:
| Package | Description | Use Case |
|---|---|---|
PDFsharp | Core library (no Windows dependencies) | Cross-platform .NET 6/8 apps |
PDFsharp-GDI | With GDI+ support | Windows Forms applications |
PDFsharp-WPF | With WPF support | WPF applications |
MigraDoc.DocumentObjectModel | MigraDoc document model | Document layout with paragraphs, tables |
MigraDoc.Rendering | MigraDoc PDF renderer | Rendering MigraDoc to PDF |
๐ MigraDoc Foundation
MigraDoc is a companion library to PDFsharp that provides a high-level document object model with automatic layout. While PDFsharp requires you to position everything manually, MigraDoc handles page breaks, paragraphs, tables, and formatting automatically.
Document Model
Sections, paragraphs, tables, headers, footers
Copyright ยฉ 2001-2026 empira Software GmbH
Styles & Formatting
CSS-like styles, character and paragraph formatting
Automatic page breaks and layout
MigraDoc Example:
using MigraDoc.DocumentObjectModel;
using MigraDoc.Rendering;
// Create document
Document doc = new Document();
Section section = doc.AddSection();
// Add paragraph with style
Paragraph para = section.AddParagraph();
para.AddText("Hello, MigraDoc!");
para.Format.Font.Size = 24;
para.Format.Font.Bold = true;
// Render to PDF
PdfDocumentRenderer renderer = new PdfDocumentRenderer();
renderer.Document = doc;
renderer.RenderDocument();
renderer.PdfDocument.Save("output.pdf");
๐ Understanding PDF Metadata
PDFsharp provides access to standard PDF metadata through the PdfDocument.Info property:
| Metadata Field | PDFsharp Property | Description |
|---|---|---|
| Title | document.Info.Title |
Document title (customizable) |
| Author | document.Info.Author |
Document author (customizable) |
| Subject | document.Info.Subject |
Document subject (customizable) |
| Keywords | document.Info.Keywords |
Searchable keywords (customizable) |
| Creator | document.Info.Creator |
Application name (defaults to PDFsharp if empty) |
| Producer | Set automatically | Always shows "PDFsharp [version] (www.pdfsharp.net)" |
| Creation Date | document.Info.CreationDate |
When the document was created |
| Modification Date | document.Info.ModificationDate |
When the document was last modified |
โ ๏ธ Producer Field Behavior
PDFsharp automatically sets the Producer field to include its product information. This cannot be changed through the normal API. If you need to modify this, you would need to edit the source code (specifically ProductVersionInfo.cs) and rebuild the library.
Read Metadata from Existing PDF:
using PdfSharp.Pdf;
using PdfSharp.Pdf.IO;
// Open existing PDF
PdfDocument doc = PdfReader.Open("existing.pdf",
PdfDocumentOpenMode.ReadOnly);
// Read metadata
Console.WriteLine($"Title: {doc.Info.Title}");
Console.WriteLine($"Author: {doc.Info.Author}");
Console.WriteLine($"Creator: {doc.Info.Creator}");
Console.WriteLine($"Producer: {doc.Info.Producer}");
Console.WriteLine($"Created: {doc.Info.CreationDate}");
๐ ๏ธ Troubleshooting
Common issues when using PDFsharp:
Font Not Found or Rendering Incorrectly
Cause: The specified font is not available on the system, or font embedding is not working.
Solution: Use fonts that are installed on the target system, or ensure font files are embedded. On Linux/Mac (cross-platform), PDFsharp Core doesn't have access to system fonts โ you may need to load fonts from files or use the GDI/WPF versions on Windows.
Cannot Change Producer Metadata
Cause: PDFsharp automatically sets the Producer field in the code and doesn't expose a public property to change it.
Solution: This is by design. If you must change it, you would need to modify the ProductVersionInfo.cs source file and rebuild PDFsharp from source. Note that commercial licenses from empira include options for "MIT-free" builds without visible product information.
PDF File is Corrupted or Won't Open
Cause: The document was not properly saved or closed, or the PDF contains unsupported features.
Solution: Always call document.Save() or document.Close(). Use try-catch blocks around PDF operations. If opening an existing PDF fails, it may use features not supported by PDFsharp (like iref streams from newer Acrobat versions).
Images Not Displaying
Cause: Image format not supported, or incorrect path/URL specified.
Solution: PDFsharp supports PNG, JPEG, GIF, TIFF, and BMP. Ensure the image file exists at the specified path. For PNG images in PDFsharp Core, the library uses BigGustave internally. If using base64 or streams, ensure proper encoding.
Text Layout Issues (No Automatic Line Breaks)
Cause: PDFsharp only provides basic text layout โ it doesn't automatically wrap text or create page breaks.
Solution: For complex document layout with automatic text wrapping, paragraph formatting, and page breaks, use MigraDoc instead of PDFsharp directly. MigraDoc provides a high-level document model with automatic layout.
โ Frequently Asked Questions
When a PDF shows "PDFsharp" followed by version information (like "PDFsharp 6.1.1 (www.pdfsharp.net)") as the Producer, it means the PDF was created or modified using the PDFsharp .NET library developed by empira Software GmbH in Germany.
Yes, PDFsharp is open-source and released under the MIT license. You can use it freely in both personal and commercial projects, including closed-source applications. empira also offers commercial support plans and "MIT-free" licensing options for companies with specific legal requirements.
PDFsharp was first released in 2005 by empira Software GmbH. The related MigraDoc library dates back to 2001. The classic PDFsharp forum was established in 2006. The libraries have been continuously developed, with the current 6.x series supporting modern .NET 6/8.
PDFsharp is a low-level library for drawing on PDF pages โ you control exact positions of text and graphics. MigraDoc is a high-level document model with sections, paragraphs, tables, and styles โ it handles layout automatically including page breaks. MigraDoc uses PDFsharp internally to generate the final PDF.
No, PDFsharp does not convert HTML to PDF. It's a programming library for creating PDFs through code. For HTML to PDF conversion, you would need additional libraries like HtmlRenderer.PdfSharp (TheArtOfDev), wkhtmltopdf, or commercial solutions like Puppeteer/Playwright.
PDFsharp 6.x supports .NET 6, .NET 8, .NET Standard 2.0, and .NET Framework 4.6.2+. The older PDFsharp 1.5 series targets .NET Framework 3.0+. The Core version has no Windows dependencies and runs cross-platform on Windows, Linux, and macOS.
PDFsharp was created and is maintained by empira Software GmbH, located in Troisdorf (Cologne Area), Germany. The main authors are Stefan Lange and Thomas Hรถvel, with contributions from a large community of developers who found issues and fixed bugs.
๐ ๏ธ Related Tools
PDF Metadata Viewer
Free tool to view PDF metadata including Creator, Producer, and version information.
View PDF Metadata โ๐ Summary: PDFsharp PDF Metadata
- PDFsharp first released in 2005
- Producer shows PDFsharp [version] (www.pdfsharp.net)
- Install via NuGet:
Install-Package PDFsharp - MIT license โ free for commercial use
- Over 40 million NuGet downloads
- Developed by empira Software GmbH
- Written in C# for .NET
- Supports .NET 6/8 and .NET Framework
- MigraDoc for high-level document layout
- GDI+ style drawing routines