Setting up document privilege works perfectly when document is opened via Adobe or Microsoft Edge but when opening the pdf document in browsers such as google chrome the permission restrictions are not applied.
Snippet of my code:
Dim document = New Aspose.Pdf.Document(fileName)
Dim privilege As Aspose.Pdf.Facades.DocumentPrivilege = Aspose.Pdf.Facades.DocumentPrivilege.ForbidAll
privilege.AllowPrint = False
Hi, @Akif_Hussein !
Please try this:
Imports Aspose.Pdf.Facades
Module Program
Sub Main()
' Create DocumentPrivileges object
Dim privilege As DocumentPrivilege
privilege = DocumentPrivilege.AllowAll
privilege.AllowPrint = False
' Create PdfFileSecurity object
Dim fileSecurity = New PdfFileSecurity()
fileSecurity.BindPdf("sample.pdf")
fileSecurity.SetPrivilege(privilege)
fileSecurity.Save("sample_privileges.pdf")
End Sub
End Module
We tested the snippet above in Google Chrome. Please take into account that some PDF Readers and Viewers skip privileges. So, if the issue is still reproduced, please let us know which app you see it in.
1 Like