Holos.Reporting.Pdf.Security 27.0.0-holos.2

This is a prerelease version of Holos.Reporting.Pdf.Security.
dotnet add package Holos.Reporting.Pdf.Security --version 27.0.0-holos.2
                    
NuGet\Install-Package Holos.Reporting.Pdf.Security -Version 27.0.0-holos.2
                    
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="Holos.Reporting.Pdf.Security" Version="27.0.0-holos.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Holos.Reporting.Pdf.Security" Version="27.0.0-holos.2" />
                    
Directory.Packages.props
<PackageReference Include="Holos.Reporting.Pdf.Security" />
                    
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 Holos.Reporting.Pdf.Security --version 27.0.0-holos.2
                    
#r "nuget: Holos.Reporting.Pdf.Security, 27.0.0-holos.2"
                    
#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 Holos.Reporting.Pdf.Security@27.0.0-holos.2
                    
#: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=Holos.Reporting.Pdf.Security&version=27.0.0-holos.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Holos.Reporting.Pdf.Security&version=27.0.0-holos.2&prerelease
                    
Install as a Cake Tool

Majorsilence.Pdf.Security

Majorsilence.Pdf.Security is tri licensed under Apache-2.0, MIT, or BSD-3-Clause. Pick your choice.

  • SPDX-License-Identifier: MIT OR Apache-2.0 OR BSD-3-Clause
  • Copyright (C) 2026 Peter Gill peter@majorsilence.com

Optional companion package for Majorsilence.Pdf that adds password-based encryption, certificate-based (public-key) encryption, and PKCS#7 digital signatures.

Installation

Add a reference to both packages. Majorsilence.Pdf.Security only activates when you call its extension methods; there is no overhead when it is referenced but not used.

Password encryption

using Majorsilence.Pdf;
using Majorsilence.Pdf.Security;

PdfDocument.Create()
    .WithSecurity(PdfSecurity.Create("ownerPass", "userPass")
        .WithEncryptionVersion(PdfEncryptionVersion.AES256))   // AES-256 (default) or AES128
    .AddPage(PageSizes.A4, c => c.DrawText("Confidential", 72, 72))
    .Save("encrypted.pdf");

PdfSecurity options

Method Description
PdfSecurity.Create(ownerPassword, userPassword) Build an options object
.WithEncryptionVersion(PdfEncryptionVersion.AES256) AES-256 R=6 / PDF 2.0 (default)
.WithEncryptionVersion(PdfEncryptionVersion.AES128) AES-128 R=4 / PDF 1.4 — broader compatibility
.WithPermissions(PdfPermissions.Print \| PdfPermissions.Copy) Restrict what users can do

AES256 automatically upgrades the document to PdfVersion.Pdf20.

Certificate-based (public-key) encryption

Only holders of the listed X.509 certificate private keys can open the document (/Filter /Adobe.PubSec, V=4, AES-128).

var recipientCert = new X509Certificate2("recipient.cer");

PdfDocument.Create()
    .WithPublicKeySecurity(
        PdfPublicKeySecurity.ForRecipients(recipientCert)
            .WithPermissions(PdfPermissions.Print))
    .AddPage(PageSizes.A4, c => c.DrawText("Eyes Only", 72, 72))
    .Save("pubkey-encrypted.pdf");

Multiple recipients are supported:

.WithPublicKeySecurity(PdfPublicKeySecurity.ForRecipients(cert1, cert2, cert3))

Digital signatures

Embed an invisible PKCS#7 detached signature (/SubFilter /adbe.pkcs7.detached):

var cert = new X509Certificate2("signer.p12", "password",
    X509KeyStorageFlags.Exportable);

PdfDocument.Create()
    .WithSignature(new PdfSignatureOptions(cert)
        .WithReason("Approved")
        .WithLocation("Toronto")
        .WithSignerName("Jane Smith"))
    .AddPage(PageSizes.A4, c => c.DrawText("Signed document", 72, 72))
    .Save("signed.pdf");

Visible signature appearance

Add a visible signature box that viewers render in the page:

new PdfSignatureOptions(cert)
    .WithSignerName("Jane Smith")
    .WithReason("Approved")
    .WithAppearance(x: 72, y: 700, width: 200, height: 50)

Coordinates use top-left origin (same convention as PdfCanvas drawing methods). The appearance box shows a border, "Digitally Signed", and the signer name.

RFC 3161 timestamps

Embed an authenticated timestamp so the signature remains verifiable after the signing certificate expires:

new PdfSignatureOptions(cert)
    .WithTimestampAuthority("http://timestamp.digicert.com")

PdfSignatureOptions builder

Method Description
WithReason(string) Signing reason shown in viewer
WithSignerName(string) Signer name shown in viewer
WithLocation(string) Signing location shown in viewer
WithTimestampAuthority(string url) RFC 3161 TSA URL for embedded timestamps
WithAppearance(x, y, width, height) Visible signature appearance box

Permissions flags

PdfPermissions is a [Flags] enum:

Value Description
PdfPermissions.Print Allow printing
PdfPermissions.Modify Allow document modification
PdfPermissions.Copy Allow content copying
PdfPermissions.Annotate Allow adding annotations
PdfPermissions.All All permissions (default)

Combining security features

A signature can be combined with password encryption:

PdfDocument.Create()
    .WithSecurity(PdfSecurity.Create("owner", "user"))
    .WithSignature(new PdfSignatureOptions(cert).WithReason("Final"))
    .AddPage(PageSizes.A4, c => c.DrawText("Encrypted and signed", 72, 72))
    .Save("secured-signed.pdf");

Note: PDF/A conformance (WithConformance) and encryption are mutually exclusive. Attempting to combine them throws InvalidOperationException at save time.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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 Holos.Reporting.Pdf.Security:

Package Downloads
Holos.Reporting.RdlEngine

Cross-platform RDL/RDLC report rendering engine — run SQL Server Reporting Services (SSRS 2005) report definitions without a report server on Linux, macOS, Windows, and containers. SkiaSharp-based rendering, Native-AOT-compatible. Renders to PDF, HTML, MHTML, CSV, Excel, and images. Targets .NET 8 and .NET 10. Fork of Majorsilence Reporting (Apache-2.0) with ReportViewer-compatible rendering of mixed run formatting and last-line overflow.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
27.0.0-holos.2 62 11/13/2026
27.0.0-holos.1 56 11/13/2026