I want to fill some fields in a PDF template and then set multiple security privileges to a document. However, it seems only the last privilege call takes effect when I view the document properties through Adobe Acrobat Pro. Is the following example the correct way to achieve these settings (I’m looking to allow Print and Form Fill with just an admin password)?
Dim template = New System.IO.FileStream(“pdf_form.pdf”, System.IO.FileMode.Open)
Dim formFilled = New System.IO.FileStream(“pdf_form_filled.pdf”, System.IO.FileMode.Create)
Dim f = New Aspose.Pdf.Kit.Form(template, formFilled)
f.FillField(“FieldName”, “MyName”)
f.FillField(“FieldEmail”, "my@email.com")
f.Save()
Dim s = New PdfFileSecurity(formFilled, formFilled)
s.SetPrivilege(DocumentPrivilege.ForbidAll)
s.SetPrivilege(DocumentPrivilege.Print) ’ If reverse this line and the next line, I get the Print permission allowed
s.SetPrivilege(DocumentPrivilege.FillIn) ’ With this line last, only form fill is allowed
s.ChangePassword("", “”, “owner”)
formFilled.Close()