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()
# 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 = PdfPrintSecurity.FullPrintRights
# Change or set the document encryption password
pdf.Password = "my-password"
pdf.SaveAs("secured.pdf")
#Open an Encrypted File, alternatively create a new PDF from Html
#Edit file metadata
#Edit file security settings
#The following code makes a PDF read only and will disallow copy And paste and printing
#Change or set the document encryption password
'INSTANT VB TODO TASK: The following line uses invalid syntax:
'from ironpdf import * pdf = PdfDocument.FromFile("encrypted.pdf", "password") pdf.MetaData.Author = "Satoshi Nakamoto" pdf.MetaData.Keywords = "SEO, Friendly" pdf.MetaData.ModifiedDate = Now() 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 pdf.Password = "my-password" pdf.SaveAs("secured.pdf")