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.

Important: some PDF readers like Firefox ignore the protection settings, which strongly reduces the usefulness of this script.

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

Note: protecting a document requires to encrypt it. If an encryption extension is available (OpenSSL or Mcrypt), it is used. Otherwise encryption is done in PHP, which can increase the processing time significantly (especially if the document contains images or fonts).