ImageGear v26.5 - Updated
Developer Guide / How to Work with ... / PDF / How to... / Use PDF Security
In This Topic
    Use PDF Security
    In This Topic

    A PDF document can be secured by encrypting its contents and requiring a password for access. Using ImageGear, apps can open and decrypt password-secured PDF documents provided that the correct password is supplied. Once a PDF document is opened, ImageGear enables apps to:

    • Set or change the PDF document's access permissions.
    • Set or change the encryption used and what gets encrypted.
    • Set or change what content gets encrypted or not.
    • Set, change, or remove the secure PDF document's password.

    Setting PDF Security

    ImageGear can set the security on a PDF document using the SetNewCryptHandler and SetNewSecurityData functions. The PDF permissions allow control of copying text and image content from the pages, the ability to print pages, as well as all other permissions defined in the ImGearPDFPermsFlags Enumeration. See the SetPDFSecurity sample for an example of how to encrypt a PDF document and secure it with an Open Document Password.

    Loading an Encrypted PDF Document

    ImageGear can decrypt and open password-secured PDF documents provided a valid authorization callback procedure is registered using the ImGearPDFDocument.RegisterAuthProc() method. This callback is expected to provide the password using the ImGearPDFDocument.PermRequest() method. See the LoadEncryptedPDF sample for an example of how to open a PDF document that requires an Open Document Password and how to remove the password and encryption from a secure PDF document.