Home arrow PHP arrow Building PDF Documents with PHP 5

Building PDF Documents with PHP 5

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.

TABLE OF CONTENTS:
  1. Building PDF Documents with PHP 5
  2. Building basic PDF documents with PHP 5 using an object-oriented approach
  3. Working with different page sizes
  4. Creating a basic A5 PDF document using PHP 5
By: Alejandro Gervasio
Rating: starstarstarstarstar / 15
October 30, 2007

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Introduction

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!



 
 
>>> More PHP Articles          >>> More By Alejandro Gervasio
 

blog comments powered by Disqus
   

PHP ARTICLES

- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...
- PHP: Building Concrete Validators
- Sanitizing Input with PHP
- Executing Shell Commands with PHP
- Handling File Data with PHP
- File Security and Resources with PHP
- ArrayObject PHP Class Examples
- ArrayObject PHP Class: An Introduction
- Getting File System Data with PHP
- PHP Tools for Working with the File and Oper...
- Working with the File and Operating System w...
- PHP Proxy Patterns: Completing a Blog


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 9 - Follow our Sitemap

Dev Shed Tutorial Topics: