Adding Text to PDFs

Obviously, you'll want to do more with your PDFs than just generate blank documents. The most important thing to be able to do is to add text, which you'll learn here.

Placing text within PDF documents is not nearly as easy or straightforward as you might think. Text cannot just be written down the page from left to right, top to bottom, as you can in your text editor or Web browser. Text in PDFs must be placed on the page as you would place points and lines on a graph. In fact, you can place the text in nearly any order and result in the same page (assuming no overlaps), but I still find it makes the most sense to code your way from the top down.

One of the trickier aspects of PDF generation is that the lower-left corner ...

Get PHP Advanced for the World Wide Web: Visual QuickPro Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.