Bookmarks in PDF documents

Bookmarks are generated automatically in various hierarchical levels for the overview and the navigation in PDF documents.

PDF bookmarks in several levels of the document hierachy are generated by the proprietary extension axf:outline-level of Antenna House. The display mode of these hierarchical levels when opening the PDF document can be determined by the axf:outline-expand attribute.

Source code

<xsl:stylesheet version="1.0" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:axf="http://www.antennahouse.com/names/XSL/Extensions"> ❶
...
<xsl:template match="Article/Title">
   <fo:block xsl:use-attribute-sets="Headline-Title1" axf:outline-level="1" axf:outline-expand="true"> ❷
      <xsl:number level="multiple" count="Article" format="1. "/>
         <xsl:value-of select="."/>
   </fo:block>
</xsl:template>
...
<xsl:template match="Article/Section/Title">
   <fo:block xsl:use-attribute-sets="Headline-Title2" axf:outline-level="2" axf:outline-expand="false"> ❸
      <xsl:number level="multiple" count="Section" format="1.1 "/>
      <xsl:value-of select="."/>
   </fo:block>
</xsl:template>
...
</xsl:stylesheet>
 

❶ In order to use the proprietary extensions of Antenna House in the stylesheet, a xmlns namespace attribute for these extensions has to be added in the <xsl:style­sheet> element (xmlns:axf) for XML-syntactical reasons.

❷ If the content of the block is adopted for the formulation of the bookmark without changes (in this example the numbered article titles), the two axf: attributes have to be specified. axf:outline-level="1" determines that the bookmark shall be created in level 1 of the hierarchical bookmark index. axf:outline-expand="true" specifies that the directly subordinated bookmarks are not displayed in the reader when opening the PDF document.

❸ It is determined in level 2 that any bookmarks in sub-levels are not displayed immediately when opening the document but merely through the activation of the appropriate dropdown icon.

Two more axf: attributes are available, namely the attributes not shown in this example, axf:outline-title and axf:outline-group. The first attribute is used in order to determine the formulation for the bookmark in place of the block content (especially required when the formulation of the bookmark object is not suitable for displaying bookmarks). The second attribute is used for the arrangement in groups of bookmarks and their joint output.

<< back next >>

Copyright © dpunkt.verlag GmbH 2004
Printing of the online version is permitted exclusively for private use. Otherwise this chapter from the book "XSL-FO in der Praxis" ("XSL-FO in practice") is subject to the same provisions as those applicable for the hardcover edition: The work including all its components is protected by copyright. All rights reserved, including reproduction, translation, microfilming as well as storage and processing in electronic systems.

dpunkt.verlag GmbH, Ringstraße 19B, 69115 Heidelberg, fon 06221-14830, fax 06221-148399, hallo@dpunkt.de