密码,安全性和元数据
可以应用细粒度元数据和安全设置。 现在包括将 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 位加密、解密和密码保护。