PrimusSaaS.PdfGenerator
2.0.0
dotnet add package PrimusSaaS.PdfGenerator --version 2.0.0
NuGet\Install-Package PrimusSaaS.PdfGenerator -Version 2.0.0
<PackageReference Include="PrimusSaaS.PdfGenerator" Version="2.0.0" />
<PackageVersion Include="PrimusSaaS.PdfGenerator" Version="2.0.0" />
<PackageReference Include="PrimusSaaS.PdfGenerator" />
paket add PrimusSaaS.PdfGenerator --version 2.0.0
#r "nuget: PrimusSaaS.PdfGenerator, 2.0.0"
#:package PrimusSaaS.PdfGenerator@2.0.0
#addin nuget:?package=PrimusSaaS.PdfGenerator&version=2.0.0
#tool nuget:?package=PrimusSaaS.PdfGenerator&version=2.0.0
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) - DefaultLetter(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 | Versions 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. |
-
net6.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Options (>= 8.0.0)
- Microsoft.Playwright (>= 1.44.0)
-
net7.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Options (>= 8.0.0)
- Microsoft.Playwright (>= 1.44.0)
-
net8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Options (>= 8.0.0)
- Microsoft.Playwright (>= 1.44.0)
-
net9.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Options (>= 8.0.0)
- Microsoft.Playwright (>= 1.44.0)
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 | 102 | 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.