IRONSOFTWAREHOME
密碼、安全性與元資料
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
密碼、安全性與元資料

密碼、安全性與元資料

IronPDF for Python提供對PDF文件安全性和元資料的全面控制,包括作者資訊、關鍵字、密碼和使用者許可限制。

入門指南

載入一個SecuritySettings物件的屬性,然後保存。 元資料和安全性設置將在一次保存操作中一起應用。

元資料屬性

  • MetaData.Author:設置在PDF屬性中可見的文件作者名稱。
  • MetaData.Keywords:設置與文件相關聯的SEO友好的關鍵字。
  • MetaData.ModifiedDate:記錄文件上次修改的時間。 Now()插入當前的時間戳。

安全設定

  • SecuritySettings.RemovePasswordsAndEncryption():在應用新設置之前,清除文件中現有的密碼和加密。
  • SecuritySettings.MakePdfDocumentReadOnly(key):限制文件編輯。 key是一個內部簽名密鑰,而不是面向使用者的密碼。
  • False,使用者無法在PDF查看器中新增註釋。
  • False,防止從PDF中複製文字。
  • False,使用者無法填寫表單欄位。
  • SecuritySettings.AllowUserPrinting:控制列印許可。 PdfPrintSecurity.FullPrintRights允許列印; 使用其他值來限制它。
  • SecuritySettings.OwnerPassword:需要密碼以編輯或更改PDF查看器中的安全設置。
  • SecuritySettings.UserPassword:需要密碼以開啟和閱讀PDF。
學習如何使用IronPDF for Python來保護PDF文件!

準備開始了嗎?

版本:2026.9剛剛發布

Key in blue circle

立即免費取得 30 天試用金鑰。

Your trial license will be sent to your email address

無任何限制。100% 解鎖。無需信用卡。

OR
bullet_checked無需信用卡或建立帳號無任何限制。100% 解鎖。無需信用卡。
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried Iron Suite
預約您的免費即時演示
Booking Badge

全球數百萬工程師的信賴

Iron Software的客戶標誌
獲取您的無義務諮詢
填寫以下表格或發送電子郵件至sales@ironsoftware.com
您的詳細資訊將始終保密。
全球數百萬工程師的信賴
Iron Software的客戶標誌
立即獲取您的30天試用金鑰。
無需信用卡或帳戶建立
PDF的Python模塊下載
使用pip安裝

版本: 2026.9

  1. 下載並安裝Python 3.7+。
  2. 如果尚未安裝,請從 pypi.org 安裝 pip。
  3. 在終端執行上述命令。
Python PDF模塊
下載模塊

版本: 2026.9

手動安裝到您的專案中

  1. 下載套件
  2. 從終端運行此命令
    pip install ironpdf-2026.9-py37-none-win_amd64.whi

從$999起的授權