Passwords, Security and MetaData

C# + VB.Net: Passwords, Security and MetaData Passwords, Security and MetaData
using IronPdf;
 


//Open an Encrypted File, alternatively create a new PDF from Html

PdfDocument Pdf = PdfDocument.FromFile("encrypted.pdf", "password");

//Edit file metadata
Pdf.MetaData.Author = "Satoshi Nakamoto";
Pdf.MetaData.Keywords = "SEO, Friendly";
Pdf.MetaData.ModifiedDate = DateTime.Now;

//Edit file security settings

//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 =  PdfDocument.PdfSecuritySettings.PdfPrintSecrity.FullPrintRights;



// chnage or set the document ecrpytion password
ExistingPdf.Password = "my-password";
Pdf.SaveAs("secured.pdf");


 
Imports IronPdf



'Open an Encrypted File, alternatively create a new PDF from Html

Private Pdf As PdfDocument = PdfDocument.FromFile("encrypted.pdf", "password")

'Edit file metadata
Pdf.MetaData.Author = "Satoshi Nakamoto"
Pdf.MetaData.Keywords = "SEO, Friendly"
Pdf.MetaData.ModifiedDate = Date.Now

'Edit file security settings

'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 = PdfDocument.PdfSecuritySettings.PdfPrintSecrity.FullPrintRights



' chnage or set the document ecrpytion password
ExistingPdf.Password = "my-password"
Pdf.SaveAs("secured.pdf")

Granular meta-data and security settings can be applied. This now includes the ability to limit PDF documents to be unprintable, read only and encrypted. 128 bit encryption, decryption and password protection of PDF documents is supported.