The target-counter and target-counter CSS Level 3 properties retrieve counter values and display information from the destinations of link elements within HTML. For building a table of contents, these properties are especially relevant and useful. In the following example, we demonstrate the inclusion of support for these properties within pdfHTML's version 3.0.3 release.
In the following example, we use the following HTML code to build a basic table of contents which routes a user to pages 1, 2, and 3 respectively. We use target-counter to gather the page of each destination within the table of contents, and display that page number to the left of each link.
This HTML, when used with a viewer that allows for CSS 3, renders to look something like the following screenshot:
We use pdfHTML to then convert our above HTML into a valid PDF document as follows:
Then, when we are finished, we are left with the attached output PDF (see below):