Protection

Informations

Author: Klemen Vodopivec
License: FPDF

Description

This script allows to protect the PDF, that is to say prevent people from copying its content, print it or modify it.

SetProtection([array permissions [, string user_pass [, string owner_pass]]])

permissions: the set of permissions. Empty by default (only viewing is allowed).
user_pass: user password. Empty by default.
owner_pass: owner password. If not specified, a random value is used.

The permission array contains values taken from the following list: Remark: the protection against modification is for people who have the full Acrobat product.

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 master password, if different from the user one, can be used to get full access.

Notes:

- Protecting a document requires to encrypt it. The Mcrypt extension is used if available. If not, the encryption is done in PHP, which can increase the processing time significantly (especially if the document contains images or fonts).

- Some PDF readers like Firefox's built-in viewer ignore the protection settings.