Skip to Main Content
PHP in a Nutshell
book

PHP in a Nutshell

by Paul Hudson
October 2005
Intermediate to advanced content levelIntermediate to advanced
372 pages
11h 35m
English
O'Reilly Media, Inc.
Content preview from PHP in a Nutshell

Adding Document Data

PDFs are designed to be read like normal printed documents, so Adobe incorporated the ability to add notes in the same manner one might scribble in a margin.

These notes, which can be edited and re-edited by readers, can also be created using PHP by calling the function pdf_add_note(). Here is an example of its use:

    pdf_add_note($pdf, 100, 500, 700, 600, "You can create notes easily
            using pdf_add_note()", "Sticky notes", "note", 1);

The second, third, fourth, and fifth parameters are, respectively, the lower-left X and lower-left Y coordinates, and the upper-right X and upper-right Y coordinates of the note boundaries. The sixth and seventh parameters are the text to put inside the note and the title to place at the top, and the final two parameters decide the icon used to display the note when closed, and whether or not the note starts open. Once the PDF is loaded, your reader is usually free to move these notes around and edit the text inside them.

In the line above, we add a 600x100 note box that is already open (use 1 to specify the note is open, and 0 to specify it is closed). Instead of note as the penultimate parameter, we have various other options: comment, insert, paragraph, newparagraph, key, or help. In several PDF readers, this parameter has no effect and can be just left as note.

Another important facet to improving the usefulness of documents is to provide meta-data regarding who created the document, and when. This can be achieved through the use ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

PHP Cookbook

PHP Cookbook

Eric A. Mann
Programming PHP

Programming PHP

Rasmus Lerdorf, Kevin Tatroe
Learning PHP

Learning PHP

David Sklar

Publisher Resources

ISBN: 0596100671Errata Page