Question on Calculating the Permissions enum values

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.

@nicoDEV

Would you kindly share your sample PDF document for our reference as well? We will test the scenario in our environment and address it accordingly.

Sure thing! The PDF is quite generic though; all I did was save a blank Microsoft Word document as a PDF, but I can attach it here anyways:
Example.pdf (29.2 KB)

If you run the following codelines, you will see the Permissions value become 3900:

Blockquote
using (Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(source))
{
DocumentPrivilege documentPrivilege = DocumentPrivilege.AllowAll;
PdfFileSecurity security = new PdfFileSecurity(pdfDocument);
security.SetPrivilege(documentPrivilege);
}
Blockquote

And then once you run this line (within the ‘using’ block above), the Permissions value changes to 3068:

Blockquote
pdfDocument.Decrypt();
Blockquote

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

  Issue ID(s): PDFNET-53530

You can obtain Paid Support services if you need support on a priority basis, along with the direct access to our Paid Support management team.

How do I view that PDFNET ticket so I can see the results of the investigation?

Do we know why the Permissions object values found on site are different than what’s in code and what binary values, 1000000 and 10000000, represent?

And what Permission and Document values are impacted and changed by the Decrypt() method?

@nicoDEV

The ticket is logged in our internal issue management system and you would not have access to it. However, we will keep you posted in this forum thread about ticket resolution progress. Furthermore, we already have logged these questions under the ticket and as soon as the ticket is fully investigated, we will share our feedback with you. Please spare us some time.

We are sorry for the inconvenience.

The issues you have found earlier (filed as PDFNET-53530) have been fixed in Aspose.PDF for .NET 23.5.