pdfcpu

Logo

A PDF processor written in Go.

View the Project on GitHub pdfcpu/pdfcpu


Changelog

Set Permissions

The PDF specification defines a set of permissions that may be set for encrypted documents. Permissions go into effect anytime an encrypted document is opened with the user password. Providing the owner password which is also known as the set permissions password or master password will give full access to the document.

You can set either none, all or permissions for print. You can also set your permission bits in binary or hex mode.

Have a look at some examples.

Usage

pdfcpu permissions set [--perm n(one)|p(rint)|a(ll)|max4Hex|max12Bits] [--upw userpw] --opw ownerpw inFile

Flags

namedescriptionrequireddefault
permpermission bitsnonone
upwuser passwordif set
opwowner passwordyes

Common Flags


Arguments

namedescriptionrequired
inFilePDF input fileyes

Examples

You have to provide any non empty password in order to change permissions:

$ pdfcpu encrypt enc.pdf --opw opw
writing enc.pdf ...

$ pdfcpu perm list enc.pdf
permission bits: 000000000000 (x000)
Bit  3: false (print(rev2), print quality(rev>=3))
Bit  4: false (modify other than controlled by bits 6,9,11)
Bit  5: false (extract(rev2), extract other than controlled by bit 10(rev>=3))
Bit  6: false (add or modify annotations)
Bit  9: false (fill in form fields(rev>=3)
Bit 10: false (extract(rev>=3))
Bit 11: false (modify(rev>=3))
Bit 12: false (print high-level(rev>=3))

pdfcpu perm set enc.pdf --perm all
pdfcpu: please provide the owner password with -opw

$ pdfcpu perm set enc.pdf --opw opw --perm all
adding permissions to enc.pdf ...
writing enc.pdf ...

$ pdfcpu perm list enc.pdf
permission bits: 111100111100 (xF3C)
Bit  3: true (print(rev2), print quality(rev>=3))
Bit  4: true (modify other than controlled by bits 6,9,11)
Bit  5: true (extract(rev2), extract other than controlled by bit 10(rev>=3))
Bit  6: true (add or modify annotations)
Bit  9: true (fill in form fields(rev>=3)
Bit 10: true (extract(rev>=3))
Bit 11: true (modify(rev>=3))
Bit 12: true (print high-level(rev>=3))