Download the PHP package setasign/fpdi without Composer
On this page you can find all versions of the php package setasign/fpdi. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download setasign/fpdi
More information about setasign/fpdi
Files in setasign/fpdi
Package fpdi
Short Description 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 automatically.
License MIT
Homepage https://www.setasign.com/fpdi
Rated 2.25 based on 4 reviews
Informations about the package fpdi
FPDI - Free PDF Document Importer
:heavy_exclamation_mark: This document refers to FPDI 2. Version 1 is deprecated and development is discontinued. :heavy_exclamation_mark:
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.
FPDI can also be used as an extension for TCPDF or tFPDF, too.
Installation with Composer
Because FPDI can be used with FPDF, TCPDF or tFPDF we haven't added a fixed dependency in the main composer.json file. You need to add the dependency to the PDF generation library of your choice yourself.
To use FPDI with FPDF include following in your composer.json file:
If you want to use TCPDF, you have to update your composer.json to:
If you want to use tFPDF, you have to update your composer.json to:
Manual Installation
If you do not use composer, just require the autoload.php in the /src folder:
If you have a PSR-4 autoloader implemented, just register the src path as follows:
Changes to Version 1
Version 2 is a complete rewrite from scratch of FPDI which comes with:
- Namespaced code
- Clean and up-to-date code base and style
- PSR-4 compatible autoloading
- Performance improvements by up to 100%
- Less memory consumption
- Native support for reading PDFs from strings or stream-resources
- Support for documents with "invalid" data before their file-header
- Optimized page tree resolving
- Usage of individual exceptions
- Several test types (unit, functional and visual tests)
We tried to keep the main methods and logical workflow the same as in version 1 but please notice that there were incompatible changes which you should consider when updating to version 2:
- You need to load the code using the
src/autoload.php
file instead ofclasses/FPDI.php
. - The classes and traits are namespaced now:
setasign\Fpdi
- Page boundaries beginning with a slash, such as
/MediaBox
, are not supported anymore. Remove the slash or use a constant ofPdfReader\PageBoundaries
. - The parameters $x, $y, $width and $height of the
useTemplate()
orgetTemplateSize()
method have more logical correct default values now. Passing0
as width or height will result in anInvalidArgumentException
now. - The return value of
getTemplateSize()
had changed to an array with more speaking keys and reusability: Usewidth
instead ofw
andheight
instead ofh
. - If you want to use FPDI with TCPDF you need to refactor your code to use the class
Tcpdf\Fpdi
(since 2.1; before it wasTcpdfFpdi
) instead ofFPDI
.
Example and Documentation
A simple example, that imports a single page and places this onto a new created page:
A full end-user documentation and API reference is available here.
All versions of fpdi with dependencies
ext-zlib Version *