Class SecurityManager


  • public class SecurityManager
    extends Object
    Allows the developer to control: user access passwords, encryption, and also who may edit, print and copy content from the PDF document.

    See: PdfDocument.getAnnotation()

    • Constructor Detail

    • Method Detail

      • getOwnerPassword

        public final String getOwnerPassword()
        Gets the owner password and enables 128-bit encryption of PDF content.

        An owner password enables other security settings.
        OwnerPassword must be set to a non-empty string value for AllowUserCopyPasteContent, AllowUserAnnotation, AllowUserFormData, AllowUserPrinting, AllowUserEdits to be restricted.

        Returns:
        owner password
      • setOwnerPassword

        public final void setOwnerPassword​(String ownerPassword)
        Sets the owner password and enables 128-bit encryption of PDF content.

        An owner password enables other security settings.
        OwnerPassword must be set to a non-empty string value for AllowUserCopyPasteContent, AllowUserAnnotation, AllowUserFormData, AllowUserPrinting, AllowUserEdits to be restricted.

        Parameters:
        ownerPassword -
      • getPassword

        public final String getPassword()
        Gets a Password used to protect and encrypt the PDF File.

        Setting a password will cause IronPDF to automatically protect the PDF file content using strong 128-bit encryption.

        Returns:
        password
      • setPassword

        public final void setPassword​(String password)
        Sets a Password used to protect and encrypt the PDF File.

        Setting a password will cause IronPDF to automatically protect the PDF file content using strong 128-bit encryption.

        Setting the password to null will remove any existing password.

        Parameters:
        password -
      • removePasswordsAndEncryption

        public final void removePasswordsAndEncryption()
        Removes all user and owner password security for a PDF document. Also disables content encryption.

        If content is encrypted at 128 bit, copy and paste of content, annotations and form editing may be disabled.

      • makePdfDocumentReadOnly

        public void makePdfDocumentReadOnly​(String ownerPassword)
        Makes this PDF document read only such that:

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

        Parameters:
        ownerPassword - The owner password for the PDF. A string for owner password is required to enable PDF encryption and all document security options.
      • setSecurityOptions

        public void setSecurityOptions​(SecurityOptions securityOptions)
        Sets advanced security settings for the PDF.

        Allows the developer to control: user access passwords, encryption, and also who may edit, print and copy content from the PDF document

        Parameters:
        securityOptions - Advanced security settings for this PDF as an instance of SecurityOptions
      • getCurrentSecurityOptions

        public SecurityOptions getCurrentSecurityOptions()
        Gets the advanced security settings for this PDF document.

        Allows the developer to control: user access passwords, encryption, and also who may edit, print and copy content from the PDF document

        Returns:
        SecurityOptions