Manuals

 

FPDI_Protection_128::SetProtection()

Description

class FPDI_Protection_128 extends FPDI_Protection {
void SetProtection ( [array $permissions=array()[, string $user_pass=''[, string $owner_pass=''[, boolean $encryption_strength=SETAPDF_ENC_RC4_40]]]] ) }

Set the permissions, owner- and userpassword.

If you don't set any password, the document will open as usual. If you set a user password, the PDF viewer will ask for it before displaying the document. The owner password, if different from the user one, can be used to get full access.

Remark: the protection against modification is for people who have the full Acrobat product.

Parameters

$permissions

This parameter defines the user privileges for a user opening or viewing the document. Each privilege has to be entered in the permissions array. Empty by default (only viewing is allowed). Depending on the encryption strength, the following entries are possible:

Privileges for 40bit encryption (standard):

print

The user is allowed to print the document. If the key length is 128bit or greater the print quality is defined by the "degraded-print" flag.

modify

The user is allowed to modify the contents of the document by operations other than those controlled by "annot-forms", "fill-in" (128bit) and "assemble" (128bit).

copy

40bit: The user is allowed to copy or otherwise extract text and graphics from the document, including extracting text and graphics (in support of accessibility to disabled users or for other purposes).

128bit: The user is allowed to copy or otherwise extract text and graphics from the document by operations other than those controlled by "screenreaders".

annot-forms

The user is allowed to add or modify text annotations, fill in interactive form fields, and, if "modify" is also set, create or modify interactive form fields (including signature fields).

More privileges for 128bit encryption:

fill-in

The user is allowed to fill in existing interactive form fields (including signature fields), even if "annot-forms" is not set.

screenreaders

The user is allowed to extract text and graphics (in support of accessibility to disabled users or for other purposes).

assemble

The user is allowed to assemble the document (insert, rotate, or delete pages and create bookmarks or thumbnail images), even if "modify" is not set.

degraded-print

The user is allowed to print the document in a form that is equivalent to a true copy of the original PDF. When this is not set (and "print" is set), printing is limited to a lesser quality (Print As Image).

$user_pass

The user password. Empty by default.

$owner_pass

The owner password. If not specified, a random value is used.

$encryption_strength

Expects an integer or predefined constant.

SETAPDF_ENC_RC4_40 = 0 - The document will be encrypted with the standard algorithm with 40-bits.

SETAPDF_ENC_RC4_128 = 1 - The document will be encrypted with the standard algorithm with 128-bits.

SETAPDF_ENC_AES = 2 - The document will be encrypted with the AES algorithm with 128-bits.