Lesson: lesson-pdf-bookmarks

This lesson will generate PDF bookmarks for the given h1 and h2 elements. Please note that PrinceXML can generate the PDF bookmarks directly. PDFreactor and Antennahous require a specific CSS property (see styles.css).

PDF files

Converter PDF Preview
PDFreactor
OK
Download
PrinceXML
OK
Download
Antennahouse
OK
Download
Vivliostyle
ERROR
Download
Vivliostyle does not support PDF bookmarks so far

Stylesheet

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
@import url("../styles/a5.css");

h1 {
    bookmark-label: content(); 
    -ah-bookmark-level: 1;
    -ro-pdf-bookmark-level: 1;
}

h2 {
    bookmark-label: content(); 
    -ah-bookmark-level: 2;
    -ro-pdf-bookmark-level: 2;
}

HTML input

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
<html>
<head>
     <link rel="stylesheet" type="text/css" href="styles.css" />
</head>
<body>
    <h1>Chapter 1</h1>
        <h2>Section 1.1</h2>
        <h2>Section 1.2</h2>
    <h1>Chapter 2</h1>
        <h2>Section 2.1</h2>
        <h2>Section 2.2</h2>
    <h1>Chapter 3</h1>
        <h2>Section 3.1</h2>
        <h2>Section 3.2</h2>
</body>
</html>