encryptPDF

encryptPDF

PREMIUM BASIC / ADVANCED

Encrypts a PDF file.

Description
public function encryptPDF (string $source, string $target, array $options)

This method allows to encrypt a PDF file. The final user will be prompted to introduce the password included in the $options array to access the contents of the resulting PDF file.

You may find a detailed description of this package in the cryptophpocx section of the API documentation.

Parameters

source

Path to the PDF document that you want to encrypt.

target

Path to the resulting encrypted PDF document.

options

The possible keys and values are (required options are shown with red background):

Key Type Description
password string String of 15 or less characters.
mode int
  • 0, RSA 40 bit;
  • 1, RSA 128 bit;
  • 2, AES 128 bit;
  • 3, AES 256 bit
  • Optional
  • default 0
Return values

Void.

Code samples

Example #1

The resulting Word document looks like: