luke-bates/162fpdi

FPDI is a collection of PHP classes facilitating developers to read pages from existing PDF documents and use them as templates in FPDF. Because it is also possible to use FPDI with TCPDF, there are no fixed dependencies defined. Please see suggestions for packages which evaluates the dependencies a

dev-main 2021-08-05 15:17 UTC

This package is not auto-updated.

Last update: 2024-04-27 03:35:33 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License

A clone of FPDI for GitHub/Composer.

FPDI is a collection of PHP classes facilitating developers to read pages from existing PDF documents and use them as templates in FPDF, which was developed by Olivier Plathey. Apart from a copy of FPDF, FPDI does not require any special PHP extensions.

Installation with Composer

FPDI is an add-on for FPDF. Additionally FPDI can be used with TCPDF. For completion we added a FPDF repository which simply clones the offical releases.

This package comes without any dependency configuration in the composer.json file. It's up to you to load the desired package as described below.

A basic installation via Composer could be done this way:

$ composer require setasign/fpdi:1.6.2

or you can include the following in your composer.json file:

{
    "require": {
        "setasign/fpdi": "1.6.2"
    }
}

Evaluate Dependencies Automatically

To load dependencies automatically we prepared kind of metadata packages. To use FPDI with FPDF use this package:

{
    "require": {
        "setasign/fpdi-fpdf": "1.6.2"
    }
}

For TCPDF use this:

{
    "require": {
        "setasign/fpdi-tcpdf": "1.6.2"
    }
}

Manual Dependencies

To support both FPDF and TCPDF its up to you to load the preferred package before the classes of FPDI are loaded. By default FPDI will extend FPDF. If the TCPDF class exists, a new FPDF class will be created which will extend TCPDF while FPDI will extend this.

To use FPDI with FPDF include following in your composer.json file:

{
    "require": {
        "setasign/fpdf": "1.8",
        "setasign/fpdi": "1.6.2"
    }
}

If you are using TCPDF, your have to update your composer.json respectively to:

{
    "require": {
        "tecnickcom/tcpdf": "6.2.13",
        "setasign/fpdi": "1.6.2"
    }
}

Additionally you have to trigger composers autoloader for the TCPDF class before you are initiating FPDI:

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