Installation System requirements and installation of FPDI

System Requirements

Generally the FPDI will run on any PHP version above 5.2.1.

An up to date PHP version (> 5.3) 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 FPDI requires an installation of FPDF, too. The documentation applies to the latest versions of all involved classes.

Installation

To install FPDI manually you just have to download the package from the project website and extract it to a folder of your choise.

Don't forget to install FPDF before!

Via Composer

FPDI can be installed officially via Composer as of version 1.5.3. The package can be found here. Just add following  to your composer.json file: 

{
    "require": {
        "setasign/fpdi": "1.*"
    }
}

For completion we also prepared a package for FPDF. Because FPDI can work with FPDF or TCPDF we do not added any  dependency configuration to the main package. Its up to you to load the desired package before you use FPDI. For the usage with FPDF your composer.json file should include following:

{
    "require": {
        "setasign/fpdf": "1.*",
        "setasign/fpdi": "1.*"
    }
}

Beginning with version 1.5.4 we introduced intermediate packages, which evaluates dependencies for both FPDF or TCPDF. To use FPDI with FPDF just add following to your composer.json: 

{
    "require": {
        "setasign/fpdi-fpdf": "1.*"
    }
}

To use FPDI with TCPDF just add following to your composer.json: 

{
    "require": {
        "setasign/fpdi-tcpdf": "1.*"
    }
}

Usage with TCPDF

FPDI can also be used with TCPDF. To manage this we use an intermediate class that is created at runtime and will extend FPDF or TCPDF depending on which class is available (fpdi_bridge.php).

It is not possible to use FPDI for both classes at the same instance.

If you'd installed FPDI and TCPDF individually via Composer you will need to trigger the autoloader of Composer before you use FPDI. This ensures that TCPDF will get loaded and FPDI will map the intermediate class in a proper way: 

PHP
class_exists('TCPDF', true); // trigger Composers autoloader to load the TCPDF class
$pdf = new FPDI();

If you use the intermediate package via Composer this is NOT needed! 

 

Version Information

FPDIs version number is represented only by two or three digits before version 2.

Version numbers are represented by three or four integer values:  

[major].[minor].[maintenance].[revision]
major
The major version.
minor
The minor version. Is incremented if new features or changes where introduced.
maintenance
The maintenance version. Is incremented by each release of a minor version.
revision
The revision number of the version control repository.

The version can be accessed by a class constant as of version 1.5:

PHP
$fpdiVersion = FPDI::VERSION;