密碼、安全性和元數據
可以應用細緻的元數據和安全設置。 現在包括限制 PDF 文件為不可列印、唯讀和加密的功能。 支持 PDF 文件的 128 位加密、解密和密碼保護。
using IronPdf; // Open an Encrypted File, alternatively create a new PDF from Html var pdf = PdfDocument.FromFile("encrypted.pdf", "password"); // Get file metadata System.Collections.Generic.List<string> metadatakeys = pdf.MetaData.Keys(); // returns {"Title", "Creator", ...} // Remove file metadata pdf.MetaData.RemoveMetaDataKey("Title"); metadatakeys = pdf.MetaData.Keys(); // return {"Creator", ...} // title was deleted // Edit file metadata pdf.MetaData.Author = "Satoshi Nakamoto"; pdf.MetaData.Keywords = "SEO, Friendly"; pdf.MetaData.ModifiedDate = System.DateTime.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 = IronPdf.Security.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");
Imports System Imports IronPdf ' Open an Encrypted File, alternatively create a new PDF from Html Private pdf = PdfDocument.FromFile("encrypted.pdf", "password") ' Get file metadata Private metadatakeys As System.Collections.Generic.List(Of String) = pdf.MetaData.Keys() ' returns {"Title", "Creator", ...} ' Remove file metadata pdf.MetaData.RemoveMetaDataKey("Title") metadatakeys = pdf.MetaData.Keys() ' return {"Creator", ...} // title was deleted ' Edit file metadata pdf.MetaData.Author = "Satoshi Nakamoto" pdf.MetaData.Keywords = "SEO, Friendly" pdf.MetaData.ModifiedDate = DateTime.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 = IronPdf.Security.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")
Install-Package IronPdf
可以應用細緻的元數據和安全設置。 現在包括限制 PDF 文件為不可列印、唯讀和加密的功能。 支持 PDF 文件的 128 位加密、解密和密碼保護。