FPDI

Import pages from existing PDF documents and use them as templates in FPDF

Free PDF Document Importer

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.

As of version 1.2.1 FPDI can also be used with TCPDF.

FPDI is published under the Apache Software License, Version 2.0.

The usage is very easy: open the document, put a page into a template, and use it like an image!

<?php
require_once('fpdf.php');
require_once('fpdi.php');

$pdf = new FPDI();

$pageCount = $pdf->setSourceFile("Fantastic-Speaker.pdf");
$tplIdx = $pdf->importPage(1, '/MediaBox');

$pdf->addPage();
$pdf->useTemplate($tplIdx, 10, 10, 90);

$pdf->Output();

About

FPDI is the first PHP/PDF script by Setasign. Inspired by an article of Marco Tabini in the php[architect] magazine, Setasign wrote the first version of FPDI in 2004.

It is based on another extension for FPDF that adds a kind of template feature to FPDF: FPDF_TPL. This class is a requirement for FPDI and can be downloaded in the downloads area as well.

FPDF_TPL does not only prepare FPDF for FPDI, but offers many other advantages:

  • data of templates are included in a PDF document only once
  • less memory usage
  • less generation time
  • smaller PDF files
  • recursive template support (use of templates in templates)

Examples of use:

  • Header generation
  • Grids for large tables over several pages
  • Table headers
  • write behind or in front of a template
  • resize a template after creation
  • etc.

It's FREE!

The »F« in FPDI stands for »free«: you may use it for any kind of project and adapt it to your needs - the license conditions of ASL 2.0 are met nevertheless.

donate via PayPal

Miscellaneous

PDF Documents > 1.4

Do you need support for PDF documents with a version higher than 1.4? Check out the new FPDI PDF-Parser!

Do you like this product?

Than it would be awesome, if you‘d recommend it to your friends!