Modern, high-performance PDF generation for .NET with full async support
Built for modern .NET development with performance, ease of use, and flexibility in mind.
Optimized for speed and low memory usage. Generate large PDFs efficiently with minimal resource consumption.
Complete async/await support for all operations. Never block your application threads.
Works seamlessly on Windows, Linux, and macOS. Deploy anywhere your .NET apps run.
Intuitive API design that makes PDF generation simple and enjoyable for developers.
Safe for concurrent operations. Use in multi-threaded applications without worrying about race conditions.
MIT licensed with no restrictions. Use it commercially without licensing fees or limitations.
See how easy it is to create professional PDFs with just a few lines of code.
using SharpPdfGen;
using SharpPdfGen.Core;
// Create a new PDF document
using var document = PdfGenerator.CreateDocument(
title: "My First PDF",
author: "John Doe"
);
// Add a page
var page = document.AddPage(PageSize.A4);
// Add content
await page.AddHeaderAsync("Welcome!");
await page.AddTextAsync("Hello, World!", 50, 120,
TextStyle.Heading);
// Save the document
await document.SaveAsync("my-first-pdf.pdf");
// Create a table
var table = new Table();
table.ColumnWidths.AddRange(new[] { 150.0, 200.0, 100.0 });
table.AddRow("Product", "Description", "Price");
table.AddRow("SharpPdfGen Pro", "Advanced features", "$49.99");
// Add styled table to page
await page.AddTableAsync(table, 50, 200);
// Add an image
var imageData = await File.ReadAllBytesAsync("logo.png");
await page.AddImageAsync(imageData, 50, 350, 200, 100);
// Merge multiple documents
var docs = new[] { doc1, doc2, doc3 };
using var merged = await PdfGenerator
.MergeDocumentsAsync(docs);
var html = @"
HTML to PDF
Convert HTML
directly to PDF!
";
// Convert HTML to PDF
using var document = await PdfGenerator
.FromHtmlAsync(html, PageSize.A4);
// Generate multiple PDFs in parallel
var tasks = Enumerable.Range(1, 10).Select(async i =>
{
using var doc = PdfGenerator.CreateDocument($"Doc {i}");
var page = doc.AddPage();
await page.AddTextAsync($"Document {i}", 50, 100);
await doc.SaveAsync($"document-{i}.pdf");
});
// Wait for all documents to be generated
await Task.WhenAll(tasks);
// Extract text from existing PDFs
var text = await document.ExtractTextAsync();
Console.WriteLine($"Extracted: {text}");
See how SharpPdfGen stacks up against other popular PDF libraries.
Feature | SharpPdfGen | PdfSharp | iText7 | QuestPDF |
---|---|---|---|---|
Open Source | ✅ MIT |
✅ MIT |
❌ AGPL* |
✅ MIT |
Async Support | ✅ Full |
❌ None |
⚠️ Limited |
❌ None |
Performance | ✅ High |
✅ High |
⚠️ Medium |
✅ High |
HTML to PDF | ✅ Yes |
⚠️ Limited |
✅ Yes |
❌ No |
Learning Curve | ✅ Easy |
⚠️ Medium |
❌ Hard |
✅ Easy |
* iText7 requires a commercial license for commercial use
Install SharpPdfGen and start generating PDFs in minutes.