PHPackages                             setasign/fpdi-protection - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PDF &amp; Document Generation](/categories/documents)
4. /
5. setasign/fpdi-protection

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

setasign/fpdi-protection
========================

A FPDI compatible version of the FPDF\_Protection script.

v2.1.1(10mo ago)324.3M—6.7%15[4 issues](https://github.com/Setasign/fpdi-protection/issues)2MITPHPPHP ^7.1 || ^8.0CI failing

Since Oct 17Pushed 3mo ago6 watchersCompare

[ Source](https://github.com/Setasign/fpdi-protection)[ Packagist](https://packagist.org/packages/setasign/fpdi-protection)[ Docs](https://github.com/Setasign/fpdi-protection)[ RSS](/packages/setasign-fpdi-protection/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (3)Versions (9)Used By (2)

FpdiProtection
==============

[](#fpdiprotection)

[![Latest Stable Version](https://camo.githubusercontent.com/e434bc89dc04f67e6432ce739a55ef186bd28817a8d70ec82cb6a4a1a4c98c96/68747470733a2f2f706f7365722e707567782e6f72672f736574617369676e2f667064692d70726f74656374696f6e2f762f737461626c652e737667)](https://packagist.org/packages/setasign/fpdi-protection) [![Total Downloads](https://camo.githubusercontent.com/a1ca14214d1b199bf44b36005e2199dc1cb2a2cf331a4cd59611a05b3c2b0672/68747470733a2f2f706f7365722e707567782e6f72672f736574617369676e2f667064692d70726f74656374696f6e2f646f776e6c6f6164732e737667)](https://packagist.org/packages/setasign/fpdi-protection) [![Latest Unstable Version](https://camo.githubusercontent.com/9476c9f5cb0bb16b0d1edd2861fc622b5b0e747f93ea6f9ebaa7b42616b557c4/68747470733a2f2f706f7365722e707567782e6f72672f736574617369676e2f667064692d70726f74656374696f6e2f762f756e737461626c652e737667)](https://packagist.org/packages/setasign/fpdi-protection) [![License](https://camo.githubusercontent.com/9dc81e60930e21c52faf48d205efc53192ff03f4c378ceef271895a9beae50f4/68747470733a2f2f706f7365722e707567782e6f72672f736574617369676e2f667064692d70726f74656374696f6e2f6c6963656e73652e737667)](https://packagist.org/packages/setasign/fpdi-protection)

A [FPDI](https://www.setasign.com/fpdi) 2 compatible and enhanced version of the [FPDF\_Protection](http://www.fpdf.org/en/script/script37.php) script.

This version requires and uses OpenSSL functions instead of Mcrypt or a user land implementation of RC4.

RC4-40bits and RC4-128bits encryption are supported.

Installation with [Composer](https://packagist.org/packages/setasign/fpdi-protection)
-------------------------------------------------------------------------------------

[](#installation-with-composer)

```
{
    "require": {
        "setasign/fpdi-protection": "^2.0"
    }
}
```

Manual Installation
-------------------

[](#manual-installation)

If you do not use composer, just require the autoload.php in the /src folder:

```
require_once('src/autoload.php');
```

If you have a PSR-4 autoloader implemented, just register the src path as follows:

```
$loader = new \Example\Psr4AutoloaderClass;
$loader->register();
$loader->addNamespace('setasign\FpdiProtection', 'path/to/src/');
```

Don't forget to install [FPDI](https://www.setasign.com/fpdi) and [FPDF](http://www.fpdf.org/), too!

Example
-------

[](#example)

This class offers one public method, which allows you to set the protection of the resulting PDF document. All other code is identically to [FPDI](https://www.setasign.com/fpdi) or [FPDF](http://www.fpdf.org/).

If you pass null or an empty string as the owner password the method will create a random owner password. The return value of this method is the owner password.

```
