Hi Aspose Tech Support,
I am just wondering, how do you apply pdf encryption and/or privileges to an opened pdf file?
This is a simple code to convert doc to pdf , but I would like to apply privileges to the pdf file without closing the pdf file, could I do that?
_____________________________________________
Dim doc As Document = New Document(".\\Test.doc")
Dim stream As MemoryStream = New MemoryStream()
doc.Save(stream, SaveFormat.FormatAsposePdf)
stream.Seek(0, SeekOrigin.Begin)
Dim xmlDoc As XmlDocument = New XmlDocument()
xmlDoc.Load(stream)
Dim pdf As Aspose.Pdf.Pdf = New Aspose.Pdf.Pdf()
pdf.IsImagesInXmlDeleteNeeded = True
pdf.BindXML(xmlDoc, Nothing)
pdf.IsTruetypeFontMapCached = True
pdf.TruetypeFontMapPath = Path.GetTempPath()
pdf.Save(".\\Test.pdf")
_____________________________________________
the pdf.kit example to apply encryption or privileges from the Aspose website is as follow,
_____________________________________________
Dim inFile As String = ".\\Test.pdf"
Dim outFile As String = ".\\Test_encrypted.pdf"
Dim fileSecurity As PdfFileSecurity = New PdfFileSecurity(inFile, outFile)
fileSecurity.EncryptFile("userpassword", "ownerpassword", PdfPrivilege.Copy Or PdfPrivilege.Print, False)
_____________________________________________
the problem is, there is additional process to create a new pdf file, I just want to avoid this process.
Thank you.
Regards,
Jarry Wijaya