Search Results for

    Show / Hide Table of Contents

    Class PdfSecuritySettings

    Enterprise-grade PDF security: pdf.SecuritySettings.MakePdfDocumentReadOnly("owner123") Control passwords, 128-bit encryption, permissions for print/copy/edit. Essential for legal, financial, and government documents. Used via PdfDocument.SecuritySettings property.

    Inheritance
    System.Object
    PdfClientAccessor
    PdfSecuritySettings
    Namespace: IronPdf.Security
    Assembly: IronPdf.dll
    Syntax
    public class PdfSecuritySettings : PdfClientAccessor

    PdfSecuritySettings is what IronPDF C# code uses for PDF security. It represents enterprise-grade PDF security: PDF.SecuritySettings.MakePdfDocumentReadOnly("owner123") Control passwords, 128-bit encryption, permissions for print/copy/edit.

    PdfSecuritySettings matters when an application needs to configure or invoke PDF security 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 PdfSecuritySettings, instantiate or obtain it from the relevant entry point in the IronPDF C# API. Key properties include AllowUserAnnotations, AllowUserCopyPasteContent, AllowUserCopyPasteContentForAccessibility, AllowUserEdits. Assign options or invoke methods on the instance to configure or perform the operation. The PDF permissions passwords covers typical usage in C# end to end.

    using IronPdf;
    
    // Obtain PdfSecuritySettings from the relevant entry point in the IronPDF API
    void Configure(PdfSecuritySettings instance)
    {
        var current = instance.AllowUserAnnotations;
        instance.MakePdfDocumentReadOnly();
    }

    For the broader workflow, see the add copy delete pages PDF guide in the IronPDF C# documentation. For broader context, the PDF security portion of the IronPDF C# API contains related types that work with PdfSecuritySettings directly. PdfSecuritySettings instances inherit additional members from PdfClientAccessor that may be relevant in advanced scenarios. In application code, treat PdfSecuritySettings 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 PdfSecuritySettings property after each operation to confirm the configured state. See the constructors, properties, and methods tables below for the complete API surface of PdfSecuritySettings. Application code typically obtains or instantiates a single PdfSecuritySettings and shares it across multiple IronPDF operations rather than recreating it per call.

    Properties

    AllowUserAnnotations

    Gets or sets the permissions for users to annotate the PDF document with comments.

    If AllowUserAnnotations is set false, the OwnerPassword must be set for the security measure to take effect.

    Declaration
    public bool AllowUserAnnotations { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if users may annotate the PDF document, otherwise false.

    AllowUserCopyPasteContent

    Gets or sets the permissions for users to extract or 'copy & paste' content (text and images) from the PDF document.

    If AllowUserCopyPasteContent is set false, the OwnerPassword must also be set for the security measure to take effect.

    Declaration
    public bool AllowUserCopyPasteContent { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if users may 'copy and paste' content out of the PDF otherwise, false.

    AllowUserCopyPasteContentForAccessibility

    Gets or sets the permissions for users to extract or 'copy & paste' content (text and images) from the PDF document for accessibility.

    Declaration
    public bool AllowUserCopyPasteContentForAccessibility { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if users may 'copy and paste' content out of the PDF otherwise, false.

    AllowUserEdits

    Gets or sets the permissions for users edit the PDF document. The features to edit the document depends entirely on the PDF client software used by the end user.

    If editing rights are restricted, then the OwnerPassword must be set for the security measure to take effect.

    Declaration
    public PdfEditSecurity AllowUserEdits { get; set; }
    Property Value
    Type Description
    PdfEditSecurity

    The PdfEditSecurity value for user edit security.

    AllowUserFormData

    Gets or sets the permissions for users to fill-in (enter data into) forms in the PDF document.

    If AllowUserFormData is set false, the OwnerPassword must be set for the security measure to take effect.

    Note. If you want to make the form readonly in Adobe Acrobat Reader please call MakePdfDocumentReadOnly(String) method or set AllowUserEdits to NoEdit and set OwnerPassword.

    Declaration
    public bool AllowUserFormData { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if users may annotate the PDF document, otherwise false. Setting AllowUserFormData true will also enable annotations.

    AllowUserPrinting

    Gets or sets the permissions for users to print the PDF document.

    If print rights are restricted, then the OwnerPassword must be set for the security measure to take effect.

    Declaration
    public PdfPrintSecurity AllowUserPrinting { get; set; }
    Property Value
    Type Description
    PdfPrintSecurity

    The PdfPrintSecurity value for user printing.

    EncryptionType

    Gets or sets the encryption algorithm used when the document is secured with a password.

    Defaults to Rc4_128 to preserve backward compatibility. Set to Aes_128 or Aes_256 for stronger, modern encryption.

    When a password is already set, changing this value re-applies encryption immediately. If no password has been set yet, the algorithm is applied once a password is assigned, so the result is the same regardless of the order in which this and the passwords are set.

    Declaration
    public PdfEncryptionType EncryptionType { get; set; }
    Property Value
    Type Description
    PdfEncryptionType

    EncryptMetadata

    Gets or sets whether the document's metadata is encrypted along with its content.

    Defaults to true (the PDF default). Only honored for AES encryption (PDF 1.5+); it has no effect for Rc4_128. Set to false to keep metadata readable/indexable while the rest of the document remains encrypted.

    Declaration
    public bool EncryptMetadata { get; set; }
    Property Value
    Type Description
    System.Boolean

    OwnerPassword

    Sets the owner password and enables encryption of PDF content (algorithm per EncryptionType, RC4 128-bit by default). An owner password is one used to enable and disable all other security settings.

    OwnerPassword must be set to a non empty string value for AllowUserCopyPasteContent, AllowUserAnnotations, AllowUserFormData,s AllowUserPrinting and AllowUserEdits to be restricted.

    Declaration
    public string OwnerPassword { get; set; }
    Property Value
    Type Description
    System.String

    UserPassword

    Sets the user password and enables encryption of PDF content (algorithm per EncryptionType, RC4 128-bit by default).

    A user password is a password that each user must enter to open or print the PDF document.

    Declaration
    public string UserPassword { get; set; }
    Property Value
    Type Description
    System.String

    Methods

    MakePdfDocumentReadOnly(String)

    Declaration
    public void MakePdfDocumentReadOnly(string OwnerPassword)
    Parameters
    Type Name Description
    System.String OwnerPassword

    RemovePasswordsAndEncryption(Boolean)

    Removes all user and owner password security for a PDF document. Also disables content encryption.

    Content is encrypted at 128 bit. Copy and paste of content is disallowed. Annotations and form editing are disabled.

    Remove all digital signatures from the PDF document. (Recommended, since they will become invalidated anyway.)
    Declaration
    public void RemovePasswordsAndEncryption(bool RemoveSignatures = true)
    Parameters
    Type Name Description
    System.Boolean RemoveSignatures
    ☀
    ☾
    Downloads
    • Download with Nuget
    • Start for Free
    In This Article
    Back to top
    Install with Nuget