密碼、安全性與元資料

IronPDF 可以修改 PDF 元資料和安全設定。 在安全性方面,這包括將 PDF 檔案設定為唯讀、不可列印、密碼保護和加密的功能。 對於元數據,這包括定義新屬性和編輯現有屬性的能力。

To manage a PDF's metadata in IronPDF for Java, the developer must first retrieve a reference to its MetadataManager. 此類別提供了直接存取和修改 PDF 元內容的方法。 開發人員可以使用同名的 getter 和 setter 快速讀取和編輯 PDF 文件中定義的常用元性質。

以下是所有帶有便捷的getter和setter方法的屬性完整列表:

  • 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.

探索用於 Java PDF 管理的 MetadataManager API

準備好開始了嗎?
版本: 2025.12 剛發表