PDFCanon 1.0.0

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

PDFCanon .NET SDK

Official .NET SDK for the PDFCanon API — normalize, sanitize, and validate PDF files.

Installation

dotnet add package PDFCanon

Authentication

Obtain an API key from the PDFCanon portal. Pass it to the client constructor or set the PDFCANON_API_KEY environment variable.

The SDK sends the key as X-Api-Key: pdfn_… in every request. If you call the REST API directly, use the same header:

curl -H "X-Api-Key: pdfn_your_key_here" https://api.pdfcanon.com/api/submissions

Quickstart

using PDFCanon;

// API key can also be set via the PDFCANON_API_KEY environment variable
using var client = new PDFCanonClient("pdfn_your_api_key_here");

// Normalize a PDF file
var response = await client.NormalizeAsync("/path/to/document.pdf");
Console.WriteLine($"Status: {response.Status}");
Console.WriteLine($"Submission ID: {response.SubmissionId}");

// Download the normalized PDF
if (response.Normalized?.Sha256 is { } sha256)
{
    byte[] normalizedPdf = await client.GetArtifactAsync(sha256);
    await File.WriteAllBytesAsync("/path/to/output.pdf", normalizedPdf);
}

Async / Webhook Flow

// Submit for async processing (returns immediately with queued/processing status)
var submission = await client.SubmitAsync("/path/to/document.pdf", new NormalizeOptions
{
    WebhookUrl = "https://your-app.example.com/webhooks/pdfcanon",
    RemoveAnnotations = true,
});

// Or poll until done
var result = await client.WaitForCompletionAsync(
    Guid.Parse(submission.SubmissionId!),
    timeout: TimeSpan.FromMinutes(5));

Webhook Signature Verification

using PDFCanon.Webhooks;

// In your webhook handler:
string rawBody = await new StreamReader(Request.Body).ReadToEndAsync();
string signature = Request.Headers["X-PDFCanon-Signature"];

// Returns true/false
bool isValid = PDFCanonWebhook.VerifySignature(rawBody, signature, "your-signing-secret");

// Or throws InvalidSignatureException
PDFCanonWebhook.ValidateSignature(rawBody, signature, "your-signing-secret");

Configuration

using var client = new PDFCanonClient(new PDFCanonClientOptions
{
    ApiKey = "pdfn_your_key",
    BaseAddress = new Uri("https://api.pdfcanon.com/api/"),
    ConnectTimeout = TimeSpan.FromSeconds(5),
    ReadTimeout = TimeSpan.FromSeconds(120),
    MaxRetries = 3,
});

Exception Hierarchy

Exception When
AuthenticationException 401 — invalid or missing API key
PolicyRejectionException 422 — PDF rejected by policy
RateLimitException 429 — rate limit exceeded
ToolchainException 5xx — server-side processing error
NetworkException Network / timeout error
PDFCanonException Base class for all above

Requirements

  • .NET 6.0 or .NET 8.0
  • No external NuGet packages required
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 was computed.  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 was computed.  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.
  • net6.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 97 4/28/2026