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).

Repository files

PDF files

Converter Status PDF Preview
PDFreactor  OK
PrinceXML  OK
Antennahouse  OK

HTML input

<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>

Stylesheet

@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;
}