Edit online

Bookmarks

The PDF Bookmarks are used to generate a hierarchical structure similar to a table of contents in a specialized view of your PDF Reader.

By default, the titles defined in the topics are used as bookmark labels.

Edit online

PDF Bookmarks - Built-in CSS

The PDF bookmarks are generated by matching the titles from the topics in the content. The built-in CSS rules are in: [PLUGIN_DIR]/css/print/p-bookmarks.css.

Edit online

How to Change the Bookmark Labels using the Navigation Title

To change the bookmark labels, you can specify a navigation title in a DITA map or topic.

This will be used as the bookmark label instead of the topic title in the table of contents and the bookmark views. There are two possibilities to do specify it:
  1. Place a <navtitle> element in the topic reference in the DITA map:
    ...
    <topicref href="topics/my_topic.dita" locktitle="yes"> 
       <topicmeta>
          <navtitle>Introduction</navtitle>
       </topicmeta>
    </topicref>
    ...
    Note: As a best practice, a @locktitle attribute with the value 'yes' is needed to activate the navigation title. The plugin applies the navigation title even if the attribute is missing.
  2. Place a <navtitle> element in the topic, as a title alternative.
    <topic id="other_topic" xml:lang="en-us">
      <title>Normal Title</title>
      <titlealts>
        <navtitle>Navigation Title</navtitle>
      </titlealts>
      <body>
    ...
Edit online

How to Control Bookmarks Depth and Sections Display in PDF.

By default, the PDF bookmarks are generated for up to 7 levels. If you need to limit them (for example, to 2 levels), you can use the following CSS rules in your customization CSS:

*[class~="topic/topic"] *[class~="topic/topic"] *[class~="topic/topic"] > *[class~="topic/title"],
*[class~="topic/topic"] *[class~="topic/topic"] *[class~="topic/topic"] *[class~="topic/topic"] > *[class~="topic/title"],
*[class~="topic/topic"] *[class~="topic/topic"] *[class~="topic/topic"] *[class~="topic/topic"] *[class~="topic/topic"] > *[class~="topic/title"],
*[class~="topic/topic"] *[class~="topic/topic"] *[class~="topic/topic"] *[class~="topic/topic"] *[class~="topic/topic"] *[class~="topic/topic"] > *[class~="topic/title"],
*[class~="topic/topic"] *[class~="topic/topic"] *[class~="topic/topic"] *[class~="topic/topic"] *[class~="topic/topic"] *[class~="topic/topic"] *[class~="topic/topic"] > *[class~="topic/title"] {
  bookmark-label:none;
}

These rules clear the labels generated by the titles starting with the depth of 3 (the topic nesting level is given by the selectors *[class~="topic/topic"]).

By default, the PDF bookmarks also include the sections. If you need to remove them, you can use the following CSS rule in your customization CSS:

*[class ~= "topic/topic"] *[class ~= "topic/section"] > *[class ~= "topic/title"],
*[class ~= "topic/topic"] *[class ~= "topic/topic"] *[class ~= "topic/section"] > *[class ~= "topic/title"],
*[class ~= "topic/topic"] *[class ~= "topic/topic"] *[class ~= "topic/topic"] *[class ~= "topic/section"] > *[class ~= "topic/title"],
*[class ~= "topic/topic"] *[class ~= "topic/topic"] *[class ~= "topic/topic"] *[class ~= "topic/topic"] *[class ~= "topic/section"] > *[class ~= "topic/title"],
*[class ~= "topic/topic"] *[class ~= "topic/topic"] *[class ~= "topic/topic"] *[class ~= "topic/topic"] *[class ~= "topic/topic"] *[class ~= "topic/section"] > *[class ~= "topic/title"],
*[class ~= "topic/topic"] *[class ~= "topic/topic"] *[class ~= "topic/topic"] *[class ~= "topic/topic"] *[class ~= "topic/topic"] *[class ~= "topic/topic"] *[class ~= "topic/section"] > *[class ~= "topic/title"] {
  bookmark-label: none;
}
Edit online

How to Specify the Open/Closed PDF Bookmark State

If you want to specify the initial state for the bookmarks (opened/expanded or closed/collapsed), you can use the bookmark-state property in your customization CSS.

For example, to specify that all bookmarks for the first three levels are opened (expanded) in the initial state, use:
*[class~="topic/topic"] > *[class~="topic/title"],
*[class~="topic/topic"] *[class~="topic/topic"] > *[class~="topic/title"],
*[class~="topic/topic"] *[class~="topic/topic"] *[class~="topic/topic"] > *[class~="topic/title"] {
     bookmark-state:open;
}
Edit online

How to Remove the Numbering From the PDF Bookmarks

By default, the PDF bookmark labels are generated while taking the text set before the chapters titles into account. Since this usually contains the part, chapter, or section numbers, the PDF Bookmarks will make use of them.

The solution is to remove the content(before) from the bookmark-label, leaving just the content(text).

In your customization CSS, add the following CSS rules:

*[class~="topic/topic"] > *[class~="topic/title"] {
  bookmark-label: content(text);  
  -ah-bookmark-label: content();
}
Important: This is a simple example that does not use the possible navigation titles, just the content of the <title> element. Copy and modify the built-in CSS for the full CSS rule that matches the <title> and <titlealts> elements:
*[class~="topic/topic"]:has(*[class~="topic/titlealts"]) > *[class~="topic/title"] {...}