We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Is there a way to map the `Aspose.Pdf.Document.Permissions` to a `Aspose.Pdf.Facades.DocumentPrivilege`?

Is there a way to map the Aspose.Pdf.Document.Permissions to a Aspose.Pdf.Facades.DocumentPrivilege?

I want to only modify specific PDF security properties on a document, e.g. ONLY disallow copy and leave the rest of the attributes untouched.
But to do so, I have to find the existing properties and modify them, before calling :

        using (var pdfOutput = new PdfFileSecurity(doc))
                    pdfOutput.EncryptFile(Password, OwnerPassword, modifiedPrivileges, KeySize.x256, Algorithm.AES);

I have started like that:

            var permissions = (Aspose.Pdf.Permissions)doc.Permissions;
            var docP = DocumentPrivilege.AllowAll;

            docP.AllowAssembly = permissions.HasFlag(Aspose.Pdf.Permissions.AssembleDocument);
            docP.AllowCopy = permissions.HasFlag(Aspose.Pdf.Permissions.???);

But there is no matching property for AllowCopy and some other properties.
Also, I will need to fill the ChangeAllowLevel, CopyAllowLevel, etc on the DocumentPrivilege object and I have no idea how. :frowning:

Any ideas?


Thank you for contacting support.

Would you please share source file and some screenshots about expected output so that we may investigate further.