There is a growing demand from our customers to extend the bookmark capability of pdf documents to XFA also. In LiveCycle Server ES3, we are introducing the support for authoring bookmarks in XFA Forms. It is also available in LiveCycle Server ES2.5 via a patch. This post will show how one can author bookmark in an XFA form and also how the final pdf does look like.
You can define bookmarks at any of the XFA containers like subform, field or area.
The XFA processor starts processing bookmarks based on the following markup definition, under any of the valid container
elements. You can also specify multiple bookmarks for the same container. However, since only one extras tag is allow under any container markup, one can always wrap multiple extras tags inside another extras tag. LiveCycle supports up to two level of nesting for extras tags.
|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 that can be used for the action parameter are:
To author bookmarks in XFA forms:
1) You can use the attached Designer macro. The macro has been written for Designer versions ES2 or later. For more information, see the blog on Design macros.
2) Download the bookmark macro from collateral.
When you invoke the macro, a dialog box (as shown above) is displayed. In the dialog box, specify all the bookmark parameter values.
Once a bookmark has been authored, generate the PDF document. The bookmarks generated are available in dynamic and static documents. Bookmarks are compatible with Reader 9.0 and 10.0. You can use bookmarks in any XFA version document.
The bookmark will be generated in the same hierarchy as it is defined in the XFA Form design.
<subform name="root"> <extras name="bookmark"> <text name="name">parent1</text> </extras> .... <subform name="level1"> <extras name="bookmark"> <text name="name">child1</text> </extras> ... <subform name="level2"> <extras name="bookmark"> <text name="name">grand1</text> </extras> ... </subform> </subform> <subform name="level1"> ... <subform name="level2"> <extras name="bookmark"> <text name="name">grand2</text> </extras> ... </subform> </subform> </subform>
For example, for the above form design, the bookmarks will be generated in the following hierarchy:
bookmarkRoot parent1 child1 grand1 grand2
- To ensure compatibility with existing Reader versions, some capabilities are limited.
- For security reasons, a user can change the value of any bookmark element/parameter except action and script.
- For dynamic forms, you cannot make changes using the script – LiveCycle Server will always generate bookmarks based on what 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 Server will generate bookmarks for all subforms, and for static PDF documents, LiveCycle Server will generate one bookmark, depending on which subform gets selected based on user input.
- Bookmarks defined for XFA containers which 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.
- Bookmarks with value runScript for the action parameter/element are disabled, if the rendered PDF is archived.
- If an interactive form with bookmark is flattened using LiveCycle Output Service, it will not retain the bookmarks that somebody has inserted after the generation of PDF using Acrobat or Assembler.