Hello, I had a question on how I can interpret which permissions are allowed/disallowed for my Aspose.Pdf.Document object.
Before I ask my question, I was hoping for some clarification, as I may be misunderstanding the Permissions enum values. I noticed the enum values for Permissions found on your site (Permissions | Aspose.PDF for .NET API Reference) do not match the enum values shown in the code. For clarification, here is the code for the Permissions enum copied and pasted, and below that I will provide a value comparison for each field from your site to the code:
Blockquote
public enum Permissions
{
PrintDocument = 4,
ModifyContent = 8,
ExtractContent = 16,
ModifyTextAnnotations = 32,
FillForm = 256,
ExtractContentWithDisabilities = 512,
AssembleDocument = 1024,
PrintingQuality = 2048
}
Blockquote
PrintDocument ---------------------> Same value
ModifyContent ----------------------> Same value
ExtractContent ---------------------> site says 10, code says 16
ModifyTextAnnotations -----------> site says 20, code says 32
FillForm-------------------------------> site says 100, code says 256
ExtractContentWithDisabilities → site says 200, code says 512
AssembleDocument --------------> site says 400, code says 1024
PrintingQuality ----------------------> site says 800, code says 2048
The max number of permissions, from these values found in code, is calculated to be 3900 decimal (or 111100111100 binary).
Here is where my main question comes in:
I am trying to determine what permissions my PDF has. When I call Aspose.Pdf.Document.Permissions, I receive the value 3068 decimal (or 101111111100 binary).
From looking at the binary value (101111111100) and comparing it to the max number of permission’s binary number (111100111100), it seems to me that all permissions other than AssembleDocument would be allowed. However, I am confused as to why the 7th and 8th number in the binary (going from right to left) are a 1 when there are no enums currently representing those two spots (decimals 64 and 128). Shouldn’t they be 0’s, or is there a reason for these two numbers I have not caught on to?
Are the two binary values 1000000 and 10000000 meant to represent some meaning? Or should I be ignoring those two values since there is no recorded meaning on your site or in the coded definition of the Permissions enum.
Are there any tips or suggestions you would give me to make sure I accurately assess my PDF for its permissions?
Edit: One other question, why does running the method call Aspose.Pdf.Document.Decrypt() automatically change the AssembleDocument permission from TRUE to FALSE? When I apply DocumentPrivilege.AllowAll to the PdfFileSecurity object representing the file, I see Permissions change its value to 3900. But when the very next line is executed, Decrypt(), the Permissions value goes to 3068.