Overview:
Sometimes it is useful to have a list of access points within the document(bookmarks) for an easy access to the document's sections.
Also, the bookmark's caption may vary depending on the assigned XML dynamic Data Source and bookmarks with caption text from the input data file are needed.
Solution:
This tutorial offers an example on how to create a dynamic bookmark.
1. Firstly, a new XFD document must be opened and the cdcatalog.xml sample file assigned as Data Source.
2. A Repeating Section of all CDs present in the catalog will be inserted. Each item in the repeating section contains a page break to better illustrate the functionality:
3. Then an id value must be set for the block-repeat element using the Navigation Bar:
• | The user must right-click on the block-repeat element and choose Properties. The Properties pane will be displayed. |
• | In the Properties pane, under the Object group is the ID field. For this example, catalog will be written as ID's value. |
4. After the id's value is set, the dynamic bookmark can be created:
• | The Bookmarks dialog bar must be opened by selecting the Bookmarks option located in the Show/Hide group under the View tab. |
• | To add a new bookmark the Add Bookmark button must be selected. The Bookmark dialog will be displayed. |
• | To display the Dynamic Features the More >> button must be selected. |
• | The arrow associated with the Repeat box must be selected. The Edit Expression dialog will be displayed. For this example, /ns:catalog/ns:cd will be inserted as XPath. |
5. This will set the bookmark's context to /ns:catalog/ns:cd. This is done in order to match the bookmark's context with that of the repeating block's. This is mandatory for the dynamic bookmark to work.
• | In the Target Object box, xfd:repeating-block (catalog) must be chosen. |
• | In the Label box, the "..." button must be selected in order to bring up the Property Value dialog. |
• | The Dynamic value from input XML option must be selected and then the arrow located at the right of the field. The Edit Expression dialog will appear. The context is now set to /ns:catalog/ns:cd because of the value filled in the Repeat field. To select the title of the current cd, the user must double click on title. To close the Edit Expression dialog OK must be selected, and then again in order to close the Property Value dialog. |
6. If all the above steps have been followed correctly, the fields in the Bookmark dialog must look like the following:
• | The OK button must be selected in order to create the bookmark. |
7. The bookmark will be displayed as Dynamic Bookmark in the Bookmarks tree, and the target id must be catalog.
8. To preview the document as PDF the Preview as PDF button located in the Generate group under the Home tab must be selected or CTRL + F5 keys pressed.
The PDF must have a bookmark for every section repeat. Because a page break has been added in the repeating block, each repeating block will be on a new page, and selecting the bookmark will navigate to the respective page: