Search Results for

    Show / Hide Table of Contents

    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
    System.Object
    PdfSignatureExtensions
    Namespace: IronPdf.Signing
    Assembly: IronPdf.dll
    Syntax
    public static class PdfSignatureExtensions : Object
    Remarks

    Related Resources:

    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 true, removes existing digital signatures before signing. Required for documents with invalid or expired signatures (default: false).

    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

    true if signing completed successfully.

    See Also

    PdfSignature
    ☀
    ☾
    Downloads
    • Download with Nuget
    • Start for Free
    In This Article
    Back to top
    Install with Nuget
    Want to deploy IronPDF to a live project for FREE?
    What’s included?
    30 days of fully-functional product
    Test and share in a live environment
    No watermarks in production
    Get your free 30-day Trial Key instantly.
    No credit card or account creation required
    Your Trial License Key has been emailed to you.
    Download IronPDF free to apply
    your Trial Licenses Key
    Install with NuGet View Licenses
    Licenses from $499. Have a question? Get in touch.