SharpPdfGen

Modern, high-performance PDF generation for .NET with full async support

$ dotnet add package SharpPdfGen
Cross-Platform
Fully Async
High Performance
MIT Licensed

Why Choose SharpPdfGen?

Built for modern .NET development with performance, ease of use, and flexibility in mind.

🚀

High Performance

Optimized for speed and low memory usage. Generate large PDFs efficiently with minimal resource consumption.

Fully Async

Complete async/await support for all operations. Never block your application threads.

🌍

Cross-Platform

Works seamlessly on Windows, Linux, and macOS. Deploy anywhere your .NET apps run.

🔧

Easy to Use

Intuitive API design that makes PDF generation simple and enjoyable for developers.

🔒

Thread-Safe

Safe for concurrent operations. Use in multi-threaded applications without worrying about race conditions.

💰

Free & Open

MIT licensed with no restrictions. Use it commercially without licensing fees or limitations.

Simple Yet Powerful

See how easy it is to create professional PDFs with just a few lines of code.

Basic PDF Creation

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");

Advanced Features

// 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);

HTML to PDF

var html = @"



    


    

HTML to PDF

Convert HTML directly to PDF!

"; // Convert HTML to PDF using var document = await PdfGenerator .FromHtmlAsync(html, PageSize.A4);

Parallel Processing

// 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}");

How We Compare

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

Get Started Today

Install SharpPdfGen and start generating PDFs in minutes.

📦

1. Install

dotnet add package SharpPdfGen
💻

2. Code

using SharpPdfGen;
var doc = PdfGenerator
  .CreateDocument();
🚀

3. Generate

await doc.SaveAsync
  ("output.pdf");