# Bookmark [back](./README.md) ## tag bookmark You can add automatic bookmark, by directly inserting the `` tag in the HTML to convert : ```html ``` ### attributes Attribute| Default | Description ---------|---------|------------- title | | Title of the bookmark level | 0 | Level of the bookmark, must be a positive integer. Level 0 is the main level ## Page Index You can insert an index (summary) of all bookmarks automatically, using the following function : ```php $html2pdf->createIndex($titre, $sizeTitle, $sizeBookmark, $bookmarkTitle, $displayPage, $onPage, $fontName, $marginTop); ``` ### parameters Parameter| Default | Description ---------|---------|------------- $title | Index | index title $sizeTitle | 20 | font size of the index title, in mm $sizeBookmark | 15 | font size of the index, in mm $bookmarkTitle | true | add a bookmark for the index, at his beginning $displayPage | true | display the page numbers $onPage | null | if null : at the end of the document on a new page, else on the $onPage page $fontName | null | font name to use. If null, use helvetica $marginTop | null | margin top to use on the index page **IMPORTANT**: If you want the summary index on a specific page (using $onPage) you must have anticipated this page during the creation of HTML (see example below). Furthermore, if the summary index takes more than one page, you must have provided the necessary number of pages... ## Example with automatic index on last page ```html

Chapter 1

Contents of Chapter 1

Chapter 2

Intro to Chapter 2

Chapter 2.1

Contents of Chapter 2.1

Chapter 2.2

Contents of Chapter 2.2

Chapter 2.3

Contents of Chapter 2.3

Chapter 3

Intro to Chapter 3

Chapter 3.1

Contents of Chapter 3.1

Chapter 3.2

Intro to Chapter 3.2

Chapter 3.2.1

Contents of Chapter 3.2.1

Chapter 3.2.2

Contents of Chapter 3.2.2
``` ```php $html2pdf = new Spipu\Html2Pdf\Html2Pdf('P','A4','en'); $html2pdf->writeHTML($html); $html2pdf->createIndex('Summary', 25, 12, true, true); $html2pdf->output(); ``` ## Example with automatic index on specific page ```html

Chapter 1

Contents of Chapter 1

Chapter 2

Intro to Chapter 2

Chapter 2.1

Contents of Chapter 2.1

Chapter 2.2

Contents of Chapter 2.2

Chapter 2.3

Contents of Chapter 2.3

Chapter 3

Intro to Chapter 3

Chapter 3.1

Contents of Chapter 3.1

Chapter 3.2

Intro to Chapter 3.2

Chapter 3.2.1

Contents of Chapter 3.2.1

Chapter 3.2.2

Contents of Chapter 3.2.2
``` ```php $html2pdf = new Spipu\Html2Pdf\Html2Pdf('P','A4','en'); $html2pdf->writeHTML($html); $html2pdf->createIndex('Summary', 25, 12, false, true, 1); $html2pdf->output(); ``` [back](./README.md)