IRONSOFTWAREHOME
Passwords, Security & Metadata
from ironpdf import *

# Open an Encrypted File, alternatively create a new PDF from Html
pdf = PdfDocument.FromFile("encrypted.pdf", "password")

# Edit file metadata
pdf.MetaData.Author = "Satoshi Nakamoto"
pdf.MetaData.Keywords = "SEO, Friendly"
pdf.MetaData.ModifiedDate = Now()

# The following code makes a PDF read only and will disallow copy & paste and printing
pdf.SecuritySettings.RemovePasswordsAndEncryption()
pdf.SecuritySettings.MakePdfDocumentReadOnly("secret-key")
pdf.SecuritySettings.AllowUserAnnotations = False
pdf.SecuritySettings.AllowUserCopyPasteContent = False
pdf.SecuritySettings.AllowUserFormData = False
pdf.SecuritySettings.AllowUserPrinting = PdfPrintSecurity.FullPrintRights

# Change or set the document encryption password
pdf.SecuritySettings.OwnerPassword = "top-secret"  # password to edit the pdf
pdf.SecuritySettings.UserPassword = "sharable"  # password to open the pdf
pdf.SaveAs("secured.pdf")
pip install ironpdf
Passwords, Security & Metadata

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. The key is an internal signing key, not a user-facing password.
  • SecuritySettings.AllowUserAnnotations: When False, users cannot add annotations in a PDF viewer.
  • SecuritySettings.AllowUserCopyPasteContent: When False, prevents copying text from the PDF.
  • SecuritySettings.AllowUserFormData: When False, form fields cannot be filled by the user.
  • SecuritySettings.AllowUserPrinting: Controls print permissions. PdfPrintSecurity.FullPrintRights allows 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.
Learn to secure PDF documents with IronPDF for Python!

Ready to Get Started?

Version:2026.9just released

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

OR
bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried Iron Suite
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required
Python Module Download for PDF
Install with pip

Version: 2026.9

  1. Download and install Python 3.7+.
  2. Install pip from pypi.org if it isn't installed already.
  3. Execute the above command in the terminal.
Python PDF Module
Download Module

Version: 2026.9

Manually install into your project

  1. Download the package
  2. Run this command from the terminal
    pip install ironpdf-2026.9-py37-none-win_amd64.whi

Licenses from $999