Click or drag to resize

Automatic Bookmarks Generation

The converter can produce bookmarks automatically in the generated PDF document for a list of specified HTML tags, element ids or CSS classes. The bookmarking is controlled by the PdfBookmarkOptions property and is enabled only when a list of CSS selectors is specified by the HtmlElementSelectors property.

For example, to enable bookmarking of the H1 and H2 tags you can use the following line of code:

pdfConverter.PdfBookmarkOptions.HtmlElementSelectors = new string[] { "H1", "H2" };

The tags to be bookmarked can be further filtered by CSS class name using the HtmlElementSelectors property. For example, to select elements having the CSS class 'bookmark', the following line of code can be added to the previous one:

pdfConverter.PdfBookmarkOptions.HtmlElementSelectors = "*.bookmark";

More details about CSS selectors can be found here.

For example, the selector for all the H1 elements is "H1", the selector for all the elements with the CSS class name 'myclass' is "*.myclass" and the selector for the elements with the id 'myid' is "*#myid".

Important: Automatic Bookmarks generatation is only available for the WebKit and WebKit2 rendering engines. The feature is not available for Blink rendering engine.