Creating Bookmarks

The Forms service enables you to create bookmarks in an XFA form, similar to how it is done in an PDF documents. A bookmark can be defined at any XFA container like a subform, field, or an area on a subform.

To create a bookmark, use the <extras> tag in any valid container. A container can have multiple bookmarks. However, only one <extras> tag is allowed in each container. To specify more than one bookmark, wrap more <extras> tags within the first <extras> tag. Also, LiveCycle supports up to two levels of nesting for <extras> tags.

A following code snippet is a sample of how a bookmark can be inserted in the XFA form:

<subform> <!-- Any container element like subform, field or area--> 
    <extras name="bookmark"> 
        <text name="name">ANY_NAME</text> 
        <text name="color">0,0,0|R,G,B</text> 
        <text name="style">normal | italic | bold | bold-italic</text> 
        <text name="action">gotoPage | setFocus | runScript</text> 
        <text name="script">ANY_FORM_LEVEL_SCRIPT</text> <!-- JavaScript only. No formcalc support --> 
    <extras> 
    ... 
</subform>

The parameters that must be used to describe the bookmark are:

Parameter

Description

name

The name of the bookmark that will appear in the bookmark pane. If it is not specified, the bookmark will not be generated.

color

The color in which the bookmark name is rendered. The color parameter should be indicated in the RGB scheme. For example, to insert a bookmark in red color, this parameter should be specified as 255,0,0. The default value for the color parameter is 0,0,0 (black).

style

The style in which the bookmark name is rendered. The default value of the style parameter is none. Other values can be bold, italic, or bold-italic.

action

The action that is performed when the bookmark is clicked. Values can be: 

  • gotoPage: This is the default value. Focus is shifted to the page where the parent subform starts.

  • setFocus: Can be used when the parent container is a field. Sets the parent field in focus.

  • runScript: Triggers JavaScripts to be run (This value is ignored in PDF/A documents).

script

Relevant, when the value of the action parameter is set to runScript. Supports only JavaScript, that contains script objects present in the document scope.

Generate the document to view the bookmarks. Bookmarks authored this way are available in static and dynamic documents. Bookmarks are compatible with Acrobat Reader 9 and Acrobat Reader X. However, bookmarks can be added to any XFA version document.

Current limitations:

  • To ensure compatibility with existing Reader versions, some capabilities are limited.

  • For security reasons, a user can change the value of any bookmark parameter, except action and script.

  • For dynamic forms, you cannot make changes using the script. LiveCycle will always generate bookmarks based on what the user has specified in the template. For example, assume that a form contains a select-one-subform type subformset, and the author has defined bookmarks for all the subforms of the subformset. In such a scenario, for dynamic PDF documents, LiveCycle will generate bookmarks for all subforms, and for static PDF documents, LiveCycle will generate one bookmark, depending on which subform gets selected based on user input.

  • Bookmarks defined for XFA containers that form master page content are ignored.

  • Bookmarks specified on containers other than subform, area, field, and draw objects are not supported, and may result in unpredictable behavior.

  • If the rendered PDF is archived, bookmarks with value runScript for the action parameter are disabled.

  • If an interactive form with bookmarks is flattened using the Output service, it will not retain the bookmarks inserted after the generation of PDF using Acrobat or Assembler.

// Ethnio survey code removed