On this Page

    _document.bookmark

    Create PDF bookmarks.

    Syntax 

    _document.bookmark(key, value)

    Parameters

    key specifies the main bookmark category, for example, "CustomerContact".

    value specifies a sub-bookmark below the category, for example, "ABC Company".

    Both parameters must be strings.

    Returned Value 

    None.

    Description 

    Note that the PDF driver bookmark feature must be enabled either with the PRT file by setting the <Bookmark>Yes</Bookmark> option, or by using the -PDFBookmark Yes command-line option. Without that setting, the bookmarks will still be encoded in the PDF and could be used by the PDFExtract tool, but they would not appear in the Adobe Reader bookmark navigation pane. To see the bookmark navigation pane in Adobe Reader use View > Show/Hide > Navigation Panes > Bookmarks. In Foxit Reader use View > Navigation Panels > Bookmarks.

    Each time the _document.bookmark routine is called the current page is added to a table of bookmarks that the PDF viewer can display. A nested hierarchy of bookmarks can be defined by setting key to a list of key names separated by the "|" (vertical bar character). For example, "CustomerContact|ABC Company". The "CustomerContact" bookmark would open a list of companies that included "ABC Company". The "ABC Company" bookmark would open a list of values, for example, contact information, as in:

    _document.bookmark("CustomerContact|ABC Company","Tony Blue 555.123.4567");

    Each individual value would go to the specific first page of the corresponding document. In the PDF viewer, when the bookmark associated with value is selected, the user will be repositioned to the first page of the document associated with that bookmark.

    Examples

    Consider a scenario where you have an invoice document. Each invoice header page has a "CustomerID" Field which is the customer's name and a "SalesRep" Field which is the company's sales representative. Merge has been configured to run a large batch of documents and to combine them into a single PDF file containing all the Invoices. On the "CustomerID" Field you add the following script:

    _document.bookmark("CustomerID", this.value); 
    _document.bookmark(SalesRep.value, this.value);

    The first line causes the PDF viewer to show a bookmark group call "CustomerID". Under that name, there will be an entry for every customer that takes you to the invoice for that customer. The second line creates a bookmark group for each unique SalesRep name. Under each sales rep there will be a list of customer names assigned to that sales rep. The result in the PDF viewer would appear as: