Installation System requirements and installation of the FPDI PDF-Parser

System Requirements

The FPDI PDF-Parser 2 will run on any PHP version above 5.6.

An up to date PHP version (> 7) is recommend for best performance and memory results.

Following PHP extension must be enabled in the PHP configuration:

  • Zlib
  • OpenSSL (to handle encrypted/password protected PDF files)

Because PDF parsing and writing is a performance intensive task the components should be used on a machine with a fast CPU. Also the max_execution_time value should be taken into account.

Same for memory usage. Because PDF documents are sometimes built with several thousands of individual objects, the components will need memory for managing these things. Maybe it is needed to touch the memory_limit value as well.

For sure the FPDI PDF-Parser 2 requires an installation of FPDI, too. The documentation applies to the latest versions of all involved classes.

Installation

First of all you have to download the package from the project website.  

Don't forget to install the latest version of FPDI before! 

The FPDI PDF-Parser 2 is an extension of the PDF parser that is shipped with FPDI by default.

Just extract the content of this package to a folder of your choice and add the /src folder to your PSR-4 autoload implementation:

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

If you do not have a PSR-4 autoloader class in use, just require the autoload file manually:

PHP
require_once('path/to/src/autoload.php');

Always use the latest versions of both FPDI and the FPDI PDF-Parser and make  sure that you do not mix the contents of both src/ folders! 

So loading FPDF, FPDI and the FPDI PDF-Parser manually your require_once statements would be:

PHP
require_once('fpdf/fpdf.php');
require_once('fpdi2/src/autoload.php');
require_once('fpdi_pdf-parser2/src/autoload.php');

$pdf = new \setasign\Fpdi\Fpdi();

With Composer

The FPDI PDF-Parser 2 can be installed through Composer as well. We setup an own composer repository which has to be added to your projects composer.json first:

{
    "repositories": [
        {
            "type": "composer",
            "url": "https://www.setasign.com/downloads/"
        }
    ]
}

By adding the new repository you can add a dependency on the FPDI PDF-Parser to your projects composer.json file:

{
    "require": {
        "setasign/fpdi_pdf-parser": "^2.0"
    }
}

You will also find this information on each download page of the FPDI PDF-Parser.

The repository requires http-basic or http-bearer authentication. Please visit your personal Composer Settings page for more details.

Instructions for Trial Versions

The package of a trial version is encoded with Ioncube which requires a loader to be installed on your server.

An trial version is separated into two parts: The PHP files and a license file.

License files are named .htFPDI_PDF-Parser.icl and are available in your personal pickup depot.

Notice the dot at the beginning of the filename!
Some systems (e.g. MAC) automatically hide such files!

The needed loaders and install instruction for the Ioncube Loader are available at: http://www.ioncube.com/loaders.php

After the installation of the Ioncube Loader, place the license file into the /src directory or an upper folder of the FPDI PDF-Parser and follow the default installation instructions.

With Composer

If you install a trial version through Composer the dependency management will automatically install an trial license (if a license is available), so that you do not need to touch a license file at any time!

All available packages for your composer.json can be found on the download page of the FPDI PDF-Parser after requesting a trial version.

General information about using the FPDI PDF-Parser with composer are available here.