xref: /plugin/dw2pdf/vendor/setasign/fpdi/README.md (revision bb7717bcc4e44b06fc01aeb8ea52a07716f70085)
1FPDI - Free PDF Document Importer
2=================================
3
4[![Latest Stable Version](https://poser.pugx.org/setasign/fpdi/v/stable.svg)](https://packagist.org/packages/setasign/fpdi) [![Total Downloads](https://poser.pugx.org/setasign/fpdi/downloads.svg)](https://packagist.org/packages/setasign/fpdi) [![Latest Unstable Version](https://poser.pugx.org/setasign/fpdi/v/unstable.svg)](https://packagist.org/packages/setasign/fpdi) [![License](https://poser.pugx.org/setasign/fpdi/license.svg)](https://packagist.org/packages/setasign/fpdi)
5
6A clone of [FPDI](https://www.setasign.com/fpdi) for GitHub/[Composer](https://packagist.org/packages/setasign/fpdi).
7
8FPDI 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.
9
10## Installation with [Composer](https://packagist.org/packages/setasign/fpdi)
11
12FPDI is an add-on for [FPDF](http://fpdf.org/). Additionally FPDI can be used with [TCPDF](http://www.tcpdf.org/).
13For completion we added a [FPDF repository](https://github.com/Setasign/FPDF) which simply clones the offical releases.
14
15This package comes without any dependency configuration in the composer.json file. It's up to you to load the desired package as described below.
16
17A basic installation via Composer could be done this way:
18
19```bash
20$ composer require setasign/fpdi:1.6.2
21```
22
23or you can include the following in your composer.json file:
24
25```json
26{
27    "require": {
28        "setasign/fpdi": "1.6.2"
29    }
30}
31```
32
33### Evaluate Dependencies Automatically
34
35To load dependencies automatically we prepared kind of metadata packages. To use FPDI with FPDF use [this](https://github.com/Setasign/FPDI-FPDF) package:
36
37```json
38{
39    "require": {
40        "setasign/fpdi-fpdf": "1.6.2"
41    }
42}
43```
44
45For TCPDF use [this](https://github.com/Setasign/FPDI-TCPDF):
46
47```json
48{
49    "require": {
50        "setasign/fpdi-tcpdf": "1.6.2"
51    }
52}
53```
54
55### Manual Dependencies
56
57To 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.
58
59To use FPDI with FPDF include following in your composer.json file:
60
61```json
62{
63    "require": {
64        "setasign/fpdf": "1.8",
65        "setasign/fpdi": "1.6.2"
66    }
67}
68```
69
70If you are using TCPDF, your have to update your composer.json respectively to:
71
72```json
73{
74    "require": {
75        "tecnickcom/tcpdf": "6.2.13",
76        "setasign/fpdi": "1.6.2"
77    }
78}
79```
80
81Additionally you have to trigger composers autoloader for the TCPDF class before you are initiating FPDI:
82
83```php
84class_exists('TCPDF', true); // trigger Composers autoloader to load the TCPDF class
85$pdf = new FPDI();
86```
87
88