Skip to content

How to get the permissions of a pdf document #2389

Answered by stefan6419846
vrrashkov asked this question in Q&A
Discussion options

You must be logged in to vote

Update: Starting at version 4.0.0, you can now use reader.user_access_permissions directly.


Old answer

Skimming through the code, there has never been a clean API for this.

reader._encryption.values.Perms holds the permission handlers (PDF 1.7, section 8.7.3).

According to the PDF docs, the P key of the encryption dictionary holds the corresponding flags. You can access the flags dictionary by this with reader.decode_permissions(reader._encryption.P). Please note that this is an internal attribute, thus this code might break in the future.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@vrrashkov
Comment options

@stefan6419846
Comment options

Answer selected by vrrashkov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants