(mPDF >= 1.0)
bookmark – Add a Bookmark to the document
<bookmark $content [ $level ] />
Add a Bookmark to the document. Bookmarks appear in Adobe Reader and link to specific points in the text. The target is set as the current writing position in the document when the Bookmark is defined.
Specifies the text to appear as a Bookmark.
$content cannot contain any of the characters: < > & ‘ or “ and must use the appropriate HTML entities e.g. <bookmark content=”< 40” />
It is recommended that you use htmlspecialchars(‘Content’, ENT_QUOTES) for this.
$level specifies the “tree” level for the Bookmark. The top level is 0. See Example 2 below. Accepts an integer from 0 to the maximum depth you wish.
Recommended placement of Bookmarks is just after the first word following the opening tag of the block element:
or alternatively just after the opening tag of the block element:
or just after a word to be marked:
Automatically Generated Bookmarks
You can automatically generate bookmarks from h1 - h6 tags, by setting the variable
Define arrays with e.g. the tag => Bookmark level
Remember bookmark levels start at 0.
H1 - H6 must be written with uppercase when defining the array.
- Bookmark() - PHP equivalent to <bookmark>