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 whetherPDF Book marks are created from HTML anchors (e.g. <a name=”Introduction” />) . This function simply sets the variable $anchor2Bookmark

Parameters

$mode

Values

0 - does not generate a bookmark

1 - generate a bookmark using the text value of the $name attribute

DEFAULT: 0

Changelog

VersionDescription
3.0 $mode = 2 removed

Examples

Example #1

<?php

$mpdf = new 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