PrimusSaaS.PdfGenerator 2.0.0

dotnet add package PrimusSaaS.PdfGenerator --version 2.0.0
                    
NuGet\Install-Package PrimusSaaS.PdfGenerator -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="PrimusSaaS.PdfGenerator" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PrimusSaaS.PdfGenerator" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="PrimusSaaS.PdfGenerator" />
                    
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 PrimusSaaS.PdfGenerator --version 2.0.0
                    
#r "nuget: PrimusSaaS.PdfGenerator, 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 PrimusSaaS.PdfGenerator@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=PrimusSaaS.PdfGenerator&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=PrimusSaaS.PdfGenerator&version=2.0.0
                    
Install as a Cake Tool

PrimusSaaS.PdfGenerator

High-fidelity PDF generation for .NET with multiple provider support.

Installation

dotnet add package PrimusSaaS.PdfGenerator

Quick Start

// In Program.cs or Startup.cs
builder.Services.AddPrimusPdfGenerator(options =>
{
    options.Provider = PdfProvider.Playwright;
    options.DefaultFormat = PdfPageFormat.A4;
});

// In your service or controller
public class ReportService
{
    private readonly IPdfGenerator _pdf;
    
    public ReportService(IPdfGenerator pdf) => _pdf = pdf;
    
    public async Task<byte[]> GenerateReportAsync(string htmlContent)
    {
        var request = new PdfGenerateRequest
        {
            HtmlContent = htmlContent,
            Options = new PdfOptions
            {
                Format = PdfPageFormat.A4,
                DisplayHeaderFooter = true,
                HeaderTemplate = "<div style='font-size:10px;text-align:center;'>My Company</div>",
                FooterTemplate = "<div style='font-size:10px;text-align:center;'>Page <span class='pageNumber'></span> of <span class='totalPages'></span></div>"
            }
        };
        
        return await _pdf.GenerateAsync(request);
    }
}

Provider Options

Provider Best For Dependencies
Playwright High-fidelity rendering, complex CSS Microsoft.Playwright
Puppeteer Node.js environments, Chrome headless Node.js runtime
PDFKit Simple documents, no browser required Pure .NET

Page Formats

  • A4 (210 × 297 mm) - Default
  • Letter (8.5 × 11 in)
  • Legal (8.5 × 14 in)
  • Tabloid (11 × 17 in)
  • Custom - Specify width and height

Features

  • ✅ HTML-to-PDF conversion
  • ✅ Full CSS support (flexbox, grid, gradients)
  • ✅ Headers and footers with page numbers
  • ✅ Watermarks and backgrounds
  • ✅ Print-optimized styling
  • ✅ Page break control
  • ✅ Multiple page formats
  • ✅ Landscape/portrait orientation

Documentation

Full documentation: https://primussoft.github.io/Primus-SaaS-Framework/docs/pdf-generator/overview

License

MIT License - see LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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 was computed.  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 PrimusSaaS.PdfGenerator:

Package Downloads
PrimusSaaS.Security.Reporting

Security reporting, compliance mapping, and branded HTML/PDF report generation for the Primus Security Suite. Produces SARIF 2.1.0, OWASP Top 10 2021 JSON/Markdown/PDF, CWE/OWASP/PCI-DSS/GDPR compliance scores, and pixel-perfect corporate HTML reports matching the Primus design system. Includes HtmlFormatter, PdfFormatter, SarifFormatter, JsonFormatter, CsvFormatter, ComplianceMapper, and SecurityReportGenerator with full triage/patch-coverage data.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0 108 1/13/2026

v2.0.0:
- Initial release as part of Primus SaaS Framework.
- Multi-provider support: Playwright, Puppeteer, PDFKit.
- HTML-to-PDF conversion with full CSS support.
- Page format options: A4, Letter, Legal, Tabloid, custom sizes.
- Headers and footers with page numbering.
- Print-optimized styling with color preservation.