PDFs with PHP part 1 (
Page 1 of 10 ) This tutorial is intended for the PHP programmer who needs to incorporate PDF
generation in a script without using external libraries such as PDFlib (often
unavailable due to licensing restrictions or lack of funds). This tutorial will
cover only the basics, which hopefully will give you a good start. PDF has a
vast set of features and possibilities which can not be covered in a short
tutorial. If you need more than what is covered here, you might want to look at
some similar yet more complete solutions available, such as the excellent work
done by Olivier Plathey on the FPDF class (http://fpdf.org), on which this tutorial is based.
Of course, you may wish to take your own route and for that there is also the
PDF reference (be warned: it’s 1,172 pages!) Basic familiarity with using PHP
classes is assumed. Knowledge of PDF file structure is not required, as all
references are explained.Overview PDF files are, after all, just plain text files with specific markup syntax that describes what should happen to objects within the document, such as text and images. It follows that, armed with some PDF logic; anyone can create a PDF file. In this tutorial you will be shown the basic features of the PDF language, to enable you to put together your own PDF document.
Learning Objectives At the end of this first part of the tutorial you should be able to put together a simple PDF class that can:
- Create and output a PDF document
- Set up page size and orientation
- Insert simple text into the page
- Handle simple font attributes
- Activate compression.
|