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.
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.
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;
}
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.
*[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;
}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();
}
<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"] {...}