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:

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 config.json or 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 project's 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

Our repository requires authentication data: You can use your credentials of your account at setasign.com to which your licenses are assigned. You will be asked for this during a composer run.

If you need to safe the credentials in your composer environment for e.g. a silten non-interactive installation you should define an individual password for composer in your profile.

See here for more information on how to store your credentials for composer. If you don't want to write the auth.json your own, just use the following command:

composer config www.setasign.com username password

Instructions for Evaluation Versions

An evaluation package is encoded with Ioncube which requires a loader to be installed on your server.

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

License files are named .htFPDI_PDF-Parser.icl 

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 an evaluation version through Composer the dependency management will automatically install an evaluation license (if a license is available), so that you do not need to touch a license file at any time!

To get the package name you'll need to require just check the download page of the FPDI PDF-Parser after requesting an evaluation version.

General information about using SetaPDF with composer are available here.