Home arrow PHP arrow Constructing Multi-Line PDF Documents with PHP 5

Constructing Multi-Line PDF Documents with PHP 5

If you’re a PHP developer interested in developing web applications that deliver the contents of their database tables in PDF format, then hopefully this group of articles will be what you’re looking for. Welcome to the second article of the series “Building PDF documents with PHP 5.” Composed of five instructive tutorials, this series shows you the basics for creating PDF files directly from your own PHP 5 scripts, and complements the theoretical concepts with copious hands-on examples.

  1. Constructing Multi-Line PDF Documents with PHP 5
  2. Review: building basic PDF documents using PHP 5
  3. Displaying multiple lines of text on a single PDF document
  4. Building a multi-line PDF document using the set_text_pos() method
By: Alejandro Gervasio
Rating: starstarstarstarstar / 2
November 06, 2007

print this article



Having introduced you to the main subject of this series, now let me refresh your memory of the topics that were discussed in the previous tutorial. In that article, we learned that creating primitive PDF documents using PHP is a process that’s reduced to spawning a new instance of the “PDFlib” class that comes bundled with the popular “PDFLib” library, and then calling one or more of its pertinent methods to open a new PDF document and a page, which usually need to include some basic contents in them, like text strings and images as well.

With regard to specifying the dimensions of the PDF page that will be used for constructing the corresponding document, the “PDFLib” package offers the handy “begin_page_ext()” method. It's useful for creating PDF pages of different sizes, including some popular formats, like A3, A4, and A5.

In addition, you saw how to include some basic texts into several PDF files by using a combination of the “set_text_pos()” and “show()” methods. Naturally these are packaged with the “PDFLib” library. In this way you learned some of the most common tasks associated with the creation of PDF files.

However, to be frank, I'm just starting to scratch the surface when it comes to building PDF files with PHP 5. There are many other helpful methods, provided by aforementioned “PDFLib” package. Thus, in this second part of the series I’ll provide you with some examples that illustrate how to build PDF files that contain multiple lines of text; remember,  in the preceding article I worked only with single-line strings. Additionally, I'll teach you how to position these texts on a given PDF page.

With the preliminaries out of the way, it’s time to continue learning more about building PDF files with PHP 5. Let’s go!

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

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- 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...

Developer Shed Affiliates


Dev Shed Tutorial Topics: