Class PdfSignatureExtensions
Extension methods for PdfSignature to sign PDF files directly without loading into memory. Provides convenient file-based signing operations for batch processing.
Example - Sign PDF file:
var signature = new PdfSignature("certificate.pfx", "password");
signature.SignPdfFile("document.pdf", removeOldSignatures: true);
Inheritance
Namespace: IronPdf.Signing
Assembly: IronPdf.dll
Syntax
public static class PdfSignatureExtensions : Object
Working with PDF signing in IronPDF runs through PdfSignatureExtensions. It represents extension methods for PdfSignature to sign PDF files directly without loading into memory.
PdfSignatureExtensions matters when an application needs to configure or invoke PDF signing from C# code. The class encapsulates the related options and behavior in a single object that is set up once and reused across render or processing calls. Typical scenarios include batch generation pipelines, templated document workflows, and integration with existing C# document services.
To use PdfSignatureExtensions, instantiate or obtain it from the relevant entry point in the IronPDF C# API. Key methods include SignPdfFile. Assign options or invoke methods on the instance to configure or perform the operation. The HTML file to PDF covers typical usage in C# end to end.
using IronPdf;
// Obtain PdfSignatureExtensions from the relevant entry point in the IronPDF API
void Configure(PdfSignatureExtensions instance)
{
instance.SignPdfFile();
}For the broader workflow, see the HTML zip file to PDF guide in the IronPDF C# documentation. For broader context, the PDF signing portion of the IronPDF C# API contains related types that work with PdfSignatureExtensions directly. PdfSignatureExtensions exposes additional members beyond those highlighted above; the reference tables on this page list the full set. In application code, treat PdfSignatureExtensions as a configured object that is constructed once and reused across operations rather than instantiated per call. Configuration is generally idempotent: assigning the same property value twice has the same effect as assigning it once. For diagnostic purposes, inspect the relevant PdfSignatureExtensions property after each operation to confirm the configured state. See the constructors, properties, and methods tables below for the complete API surface of PdfSignatureExtensions. Application code typically obtains or instantiates a single PdfSignatureExtensions and shares it across multiple IronPDF operations rather than recreating it per call.
Methods
SignPdfFile(PdfSignature, String, Boolean, String, String)
Digitally signs an existing PDF file using the specified certificate. The file is loaded, signed, and saved back to the same path.
Example:
var signature = new PdfSignature("certificate.pfx", "password");
// Sign single file:
signature.SignPdfFile("contract.pdf");
// Sign encrypted PDF with old signatures removed:
signature.SignPdfFile("encrypted.pdf",
removeOldSignatures: true,
userPassword: "user123",
ownerPassword: "owner456");
// Batch sign multiple files:
foreach (var file in Directory.GetFiles("contracts", "*.pdf"))
{
signature.SignPdfFile(file, removeOldSignatures: true);
}
Declaration
public static bool SignPdfFile(this PdfSignature signature, string pdfFilePath, bool removeOldSignatures = false, string userPassword = null, string ownerPassword = null)
Parameters
| Type | Name | Description |
|---|---|---|
| PdfSignature | signature | The PdfSignature certificate to use for signing. |
| System.String | pdfFilePath | Full or relative path to the PDF file to sign. |
| System.Boolean | removeOldSignatures | If |
| System.String | userPassword | User password if the PDF is encrypted for viewing (default: null). |
| System.String | ownerPassword | Owner password if the PDF has restricted permissions (default: null). |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|