05.05.2013 Views

Programming PHP

Programming PHP

Programming PHP

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Figure 10-13. A templated page<br />

Bookmarks and Thumbnails<br />

Bookmarks make it easy to quickly navigate through long PDF documents. You can<br />

create a bookmark with the pdf_add_bookmark( ) function, which returns a bookmark<br />

handle:<br />

$bookmark = pdf_add_bookmark(pdf, text, parent, open);<br />

The text parameter is the label that the user sees. To create a nested menu of bookmarks,<br />

pass a bookmark handle as the parent option. The current location in the<br />

PDF file (as it is being created) is the destination of the bookmark.<br />

Bookmarks can have thumbnails associated with them. To make a thumbnail, load<br />

an image and call pdf_add_thumbnail( ):<br />

pdf_add_thumbnail(pdf, image);<br />

Example 10-12 creates a top-level bookmark named “Countries” and nests two<br />

bookmarks, “France” and “New Zealand”, under the “Countries” bookmark. It also<br />

creates a representative thumbnail image for each page. These thumbnails can be<br />

viewed in Acrobat Reader’s thumbnail panel.<br />

Example 10-12. Using bookmarks and thumbnails<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!