Passwords, Security & Metadata
IronPDF allows the ability to encrypt, decrypt, modify metadata, and set certain permissions regarding annotations, copying and pasting content, form fields, and printing.
To open a password-protected PDF document, use the open
method and provide the password as the second parameter. Setting metadata requires creating a new Map and inputting key-value pairs corresponding to the metadata information. Pass the new metadata map into the overrideMetadata
method to override the old metadata.
The removePasswordsAndEncryption
method is used to remove any password from the document. The makePdfDocumentReadOnly
method will make this PDF document read-only, encrypting content at 128 bits and disallowing copy and paste of content, annotations, and form editing.
Configure permissions by creating a permission object with permission settings and pass it to the setPermission
method.
Lastly, the saveAs
method can facilitate an object with ownerPassword
and userPassword
properties to be set respectively.