DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

EXT: FPDF and FPDI

Author:Kasper Skårhøj
Created:2002-11-01T00:32:00
Changed by:David Brühlmeier
Changed:2009-05-25T07:38:31.650000000
Author:David Bruehlmeier
Email:typo3@bruehlmeier.com
Info 3:
Info 4:

EXT: FPDF and FPDI

Extension Key: fpdf

Copyright 2006-2009, David Bruehlmeier, <typo3@bruehlmeier.com>

FPDF: copyright by Olivier Plathey

FPDI: copyright by Setasign - Jan Slabon

This document is published under the Open Content License

available from http://www.opencontent.org/opl.shtml

The content of this document is related to TYPO3

- a GNU/GPL CMS/Framework available from www.typo3.com

Table of Contents

EXT: FPDF and FPDI 1

Introduction 1

What does it do? 1

Users manual 1

Configuration 2

Known problems 2

To-Do list 2

Changelog 2

Introduction

What does it do?

This extension is the FPDF library ( www.fpdf.org ) ported to TYPO3. It is only useful for extension developers who want to build PDF-functionality. It cannot be used by itself. The extension also includes the FPDI library ( fpdi.setasign.de ) which allows you to use PDF templates when creating your own PDF files.

The current version of this extension is using the following libraries:

  • FPDF version 1.6
  • FPDI version 1.3
  • FPDF_TPL version 1.1.3

Because of the latest FPDI-version, this extension requires PHP >= 4.2.

Users manual

This section only explains how to use FPDF with TYPO3. For further references on the functionality of FPDF, please refer to the official FPDF-documentation ( www.fpdf.org ).

First thing you need to do when you want to work with the FPDF library is to include it in the script where you want to use it:

if (t3lib_extMgm::isLoaded('fpdf'))    {
  require(t3lib_extMgm::extPath('fpdf').'class.tx_fpdf.php');
}

Then you can start building your PDF document, just like documented in the FPDF-docs. For instance:

    // Get a new instance of the FPDF library
$pdf = new PDF($orientation, $unit, $format);

If you want to have a look at a working implementation, check out the extension “Partner” and look at the file inc/class.tx_partner_format.php, function formatAsPDF(). There you can also see how to use a PDF template.

The only modification done to the original FPDF library is for adding own fonts. This can be achieved by adding the proper font-definition to the ext_localconf.php file of your extension:

    // Add fonts to the fpdf library
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['fpdf']['fonts']['frutiger.z'] = array('Frutiger', '', t3lib_extMgm::extPath('myext').'font/', 'frutiger.php');
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['fpdf']['fonts']['frutigerb.z'] = array('Frutiger', 'B', t3lib_extMgm::extPath('myext').'font/', 'frutigerb.php');

Please refer to the FPDF-documentation to see how to create the necessary font-definition files (frutiger.php and frutigerb.php in the example above).

Configuration

The only configuration possible is the inclusion of own font definitions (please refer the chapter “User manual”).

Known problems

None yet.

To-Do list

Nothing planned

Changelog

  • 2009-05-25
    • Updated to FPDF version 1.6
    • Updated to FPDF_TPL version 1.1.3
    • Updated to FPDI version 1.3
    • Migrated the code to include own fonts to the latest version of FPDF.
    • Included a new version of class.tx_fpdf.php. Thanks a lot to Peter Klein for this contribution!
    • All require-statements now use TYPO3-relative paths.
  • 2007-06-22: Bugfix (wrong version of fpdf_tpl.php was included) and added unit testcases
  • 2007-05-22: Updated to FPDI version 1.2
  • 2005-04-08: First version (FPDF version 1.53 and FPDI version 1.01)

img-1 EXT: FPDF and FPDI - 2