LXXX. PDF functions
Introduction
The PDF functions in PHP can create PDF files using the
PDFlib library created by Thomas Merz.
The documentation in this section is only meant to be an
overview of the available functions in the PDFlib library
and should not be considered an exhaustive reference. Please
consult the documentation included in the source distribution
of PDFlib for the full and detailed explanation of each
function here. It provides a very good overview of what
PDFlib is capable of doing and contains the most up-to-date
documentation of all functions.
All of the functions in PDFlib and the PHP module have
identical function names and parameters. You will need to
understand some of the basic concepts of PDF and PostScript
to efficiently use this extension. All lengths and coordinates
are measured in PostScript points. There are generally 72
PostScript points to an inch, but this depends on the output
resolution. Please see the PDFlib documentation included
with the source distribution of PDFlib for a more thorough
explanation of the coordinate system used.
Please note that most of the PDF functions require a pdfdoc
as its first parameter. Please see the examples below for
more information.
Note: If you're interested in alternative free PDF generators
that do not utilize external PDF libraries, see this related
FAQ.
Requirements
PDFlib is available for download at http://www.pdflib.com/products/pdflib/index.html,
but requires that you purchase a license for commercial
use. The JPEG and TIFF libraries are required to compile
this extension.
Issues with older versions of PDFlib
Any version of PHP 4 after March 9, 2000 does not support
versions of PDFlib older than 3.0.
PDFlib 3.0 or greater is supported by PHP 3.0.19 and later.
Installation
To get these functions to work, you have to compile PHP
with --with-pdflib[=DIR]. DIR is the PDFlib base install
directory, defaults to /usr/local. In addition you can specify
the jpeg, tiff, and pnglibrary for PDFlib to use, which
is optional for PDFlib 4.x. To do so add to your configure
line the options --with-jpeg-dir[=DIR] --with-png-dir[=DIR]
--with-tiff-dir[=DIR].
When using version 3.x of PDFlib, you should configure
PDFlib with the option --enable-shared-pdflib.