Passwords, Security & Metadata
IronPDF for Python provides comprehensive control over PDF document security and metadata — including author information, keywords, passwords, and user permission restrictions.
Getting Started
Load a PdfDocument, modify properties on its MetaData and SecuritySettings objects, then save. Both metadata and security settings are applied together in a single save operation.
Metadata Properties
MetaData.Author: Sets the document author name visible in PDF properties.MetaData.Keywords: Sets SEO-friendly keywords associated with the document.MetaData.ModifiedDate: Records when the document was last modified.Now()inserts the current timestamp.
Security Settings
SecuritySettings.RemovePasswordsAndEncryption(): Clears any existing passwords and encryption from the document before applying new settings.SecuritySettings.MakePdfDocumentReadOnly(key): Restricts editing of the document. Thekeyis an internal signing key, not a user-facing password.SecuritySettings.AllowUserAnnotations: WhenFalse, users cannot add annotations in a PDF viewer.SecuritySettings.AllowUserCopyPasteContent: WhenFalse, prevents copying text from the PDF.SecuritySettings.AllowUserFormData: WhenFalse, form fields cannot be filled by the user.SecuritySettings.AllowUserPrinting: Controls print permissions.PdfPrintSecurity.FullPrintRightsallows printing; use other values to restrict it.SecuritySettings.OwnerPassword: Password required to edit or change security settings in a PDF viewer.SecuritySettings.UserPassword: Password required to open and read the PDF.






