Search Locate Previous Next Contents

chBookmark – add outline entry for chart

Multi-page collections of charts may be bookmarked with easily recognised names which can be organised into a tree structure to be shown by the Acrobat Reader as ‘Outlines’. It is also possible to create entries in the outline tree which jump to external resources, typically webpages or other PDFs.

The simple form of the command is ...

chBookmark 'Sales analysis'

The bookmark will be placed on the next chart to be generated – you may call chBookmark several times in succession to create an outline structure if required.

Making an indented outline for Acrobat Reader
The outline information is included in the PDF file generated using pdf.PS. It will often be helpful to indicate the outline level of the bookmark, with major sections at level-0 and subsidiary sections indented to form a contents tree.

chBookmark 'Sales analysis' 0
chBookmark 'Europe' 1
chBar europe
chNewPage
chBookmark 'Asia' 1
chBar asia

... and so on. This structure will then appear in the Acrobat Viewer outline bar to the left of the document. By default, sections will be closed on opening the document – you can force the Acrobat Viewer to open a section automatically by appending 1 as the final parameter to the bookmark call:

chBookmark 'Profit and Loss' 0 1
chBookmark 'Income breakdown' 1 1
chBookmark 'Consulting' 1

Linking to webpages
You can add a link to an external resource by including a 4th element in the call, for example:

chBookmark 'Home page' 0 1 'http://www.grapl.com'

This will allow the user to click on the outline entry and automatically open a web-browser at the page you give. To have Acrobat Reader load another PDF, just use a filename here in place of the url.

Documents including outline information will automatically show the outline bar when opened in the Acrobat viewer unless the PDF was explicitly set to be rendered in FullScreen mode..

Checking the bookmark table
If you want to construct your own viewer, with a tree-structured table of contents, you can check the page-count, title and bookmarks table with info„psInfo spl. The bookmarks table is a 3-column matrix giving the bookmark name, page number and indent level. Page numbers of 0 represent external links and should be masked out here by your application.

See also ...
chNewPage – request a new page


Continue to: chClose – completing the chart
© Copyright Causeway Graphical Systems Ltd 2003