SetAnchor2Bookmark()
(mPDF ≥ 1.0)
SetAnchor2Bookmark – Specifies whether PDF Bookmarks are created automatically from HTML anchors
Description
void SetAnchor2Bookmark ( int $mode )
Specifies whether PDF Book marks are created from HTML anchors (e.g. <a name="Introduction" />
) .
Note: This function/method was altered in mPDF 2.2 by capitalising the first letter of the name. As function/method names in PHP have hitherto been case-insensitive, this should not cause any problems, but it is recommended where possible to use the preferred spelling.
Parameters
- $mode
-
Set the variable with one of the values.
Values
0
- does not generate a bookmark1
- generate a bookmark using the text value of thename="Text"
attribute
Default:
0
Changelog
Version | Description |
---|---|
3.0 |
|
Examples
Example #1
<?php
$mpdf = new \Mpdf\Mpdf();
$mpdf->SetAnchor2Bookmark(1);
$mpdf->WriteHTML('<h1><a name="Section 1" />The title</h1>');
$mpdf->Output();
This will create a Bookmark in the PDF document: “Section 1”
Notes
Note: Prior to mPDF 3.0 you could specify $mode = 2
which added
the page number to the bookmark e.g. “Introduction (p.32)”. This was removed as it did not accurately handle
pagebreaks etc.