Passwords, Security & Metadata
IronPDF can make modifications to PDF metadata and security settings. In terms of security, this includes the ability to make PDFs read-only, unprintable, password protected, and encrypted. For metadata, this includes the ability to define new properties and edit existing ones.
To manage a PDF's metadata in IronPDF for Java, the developer must first retrieve a reference to its MetadataManager
. This class provides methods for direct access and modification of the PDF's meta content. Developers can quickly read and edit commonly-defined meta properties defined on PDF documents using getters and setters with the same name.
The full list of properties with convenient getters and setters is below:
Producer
CreationDate
Creator
Author
Keywords
Subject
Title
ModifiedDate
The code example uses the setAuthor
, setTitle
, setKeywords
, and setModifiedDate
methods to modify the working document's author, title, and keywords.
To get and set properties other than the ones previously listed, use the getAnyMetadata
and setAnyMetadata
methods with the name of the desired property.
Likewise, accessing and modifying security settings on a PDF document must be done through a SecurityManager
. Call getSecurity
on a PdfDocument
to retrieve a reference to its SecurityManager
and use it to restrict access to the PDF as required for the intended use.
Java developers can use a SecurityOptions
object for more granular control over PDF security settings.