mPDF Manual – mPDF functions

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" />) .

Parameters

$mode

Set the variable with one of the values.

Values

  • 0 - does not generate a bookmark
  • 1 - generate a bookmark using the text value of the name="Text" attribute

Default: 0

Changelog

Version Description
3.0

$mode = 2 removed

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

Fork me on GitHub