Hi,
I'm using following function to secure my document.
Public Function SecureDocument(ByVal InStream As Stream) As Stream
Dim OutStream As Stream = InStream
'Apply privileges
Dim fileSecurity As PdfFileSecurity = New PdfFileSecurity(InStream, OutStream)
fileSecurity.SetPrivilege(DocumentPrivilege.Print)
Return OutStream
End Function
Attaching also the generated secured doc file.
If you go through document properties, in Security Tab, you can see
Permissions Password: Yes
As you can see, I'm not setting any password for this document & if I want to change the settings, it asks for a password.
This is my 1st problem.
Now, 2nd problem is that I'm using
Dim PDFDoc As New Aspose.Pdf.Document(InStream)
Dim OptiStream As New MemoryStream
PDFDoc.OptimizeSize = True
PDFDoc.Optimize()
PDFDoc.Save(OptiStream)
Return OptiStream
this code to optimize the document.
If I try it after securing it, this code throws exception "Object not found"
If I secure the document after optimaization, it again increases it's size by almost 100-120%. I can't optimize it once it is secured.
I'm using latest Aspose.PDF.dll (7.1.0.0)