PHP is a versatile language with some surprising capabilities. It can even create PDF documents on the fly, with the right third-party PDF library. If you can't imagine why you'd want to do that, think about the various formats used by applications when retrieving data from databases -- and keep reading.
As the enthusiastic PHP programmer that you surely are, you’ll certainly know that this mature server-side scripting language can be used in all sorts of clever ways to develop a huge variety of applications, including form validation systems, full-featured database abstraction layers, powerful error loggers, and so forth. And certainly, the list goes on and on.
The flexibility and versatility offered by PHP is remarkable when it comes to building applications that will be used for different website development purposes. However, it isn’t my intention here to enumerate the thorough advantages of PHP.
Nonetheless, there’s one thing that I’d like to stress here with reference to the robust capabilities offered by PHP. As you probably heard, this powerful server-side scripting language has the venerable capacity (yes, that's the right adjective) for dynamically building PDF documents. This feature makes it suitable for use with web applications that deliver database contents in PDF files.
Of course, the ability to create PHP documents on the fly comes at a cost. PHP 5 currently doesn’t support this feature natively, which means that you'll need to download a third-party PDF library to start generating PDF files quickly. PHP’s official web site recommends the use of the popular PDFlib package, which offers support for multiple programming languages, such as Python, Perl, and naturally PHP. The down side to using this library is that you’ll have to pay a license to use it commercially.
If you prefer, you can use an streamlined version of the PDFlib package, called “PDFlite,” but it lacks some important features which are present in the commercial version. In either case, you may want to first download this library (or another one of your choice), and then install it on your on testing server, and finally get started with building basic PDF documents directly from your PHP scripts.
So, if creating dynamic PDF files with PHP 5 is an interesting topic to you, keep reading. In this series of articles I’ll show you how to start using the “PDFlib” package to build basic PDF documents. In upcoming articles I’ll cover other important characteristics, like including images into a PDF file, displaying blocks of text, and drawing basic shapes.
Let’s not waste any more time in preliminaries. Click on the link below to start learning how to build dynamic PDF documents with PHP 5. Let’s begin now!