Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

DynaPDF.AddBookmark

Adds a bookmark to the global outline tree of the document.

Component Version macOS Windows Linux Server iOS SDK
DynaPDF 4.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "DynaPDF.AddBookmark"; PDF; Title; Parent; DestPage { ; Open } )   More

Parameters

Parameter Description Example Flags
PDF The PDF reference returned from DynaPDF.New. $pdf
Title Title of the bookmark "Chapter 2"
Parent The Parent bookmark or -1. -1
DestPage Destination page. 5
Open Optional, whether bookmark should appear open initially. Default is 0 for closed. 0 Optional

Result

Returns Handle of bookmark or error.

Description

Adds a bookmark to the global outline tree of the document.
It sets also the page mode to pmUseOutlines (see DynaPDF.SetPageMode). If the outline tree should not be shown when opening the document, then set the page mode back to pmUseNone or any other value before closing the PDF file.
Parent can be a handle of another bookmark if it should be added as a child of this bookmark. If Parent is set to -1 the bookmark is added as a root node.
DestPage specifies the page that should be opened when clicking on the bookmark. The parameter can be set to a page number that does not yet exist. If the page does not exist when closing file then it is adjusted to page number 1.
The parameter Open specifies whether a bookmark node should appear open or closed when it contains children. When a bookmark contains no children then this parameter should be set to false.

Related functions: DynaPDF.AddBookmarkEx, DynaPDF.ChangeBookmark, DynaPDF.InsertBookmark, DynaPDF.InsertBookmarkEx, DynaPDF.SetBookmarkDest, DynaPDF.SetBookmarkStyle.

See also AddBookmark function in DynaPDF manual.

Examples

Add a bookmark to link to page 5

Set Variable [ $bookmarkHandle; Value: MBS( "DynaPDF.AddBookmark"; $PDF; "Test"; -1; 5; 0 ) ]

Add multiple nested bookmarks:

Set Variable [ $bookmarkParent; Value: MBS( "DynaPDF.AddBookmark"; $PDF; "1 Animals"; -1; 5; 0 ) ]
Set Variable [ $bookmarkChild; Value: MBS( "DynaPDF.AddBookmark"; $PDF; "1.1 Apes"; $bookmarkParent; 6; 0 ) ]
Set Variable [ $bookmarkGrandChild; Value: MBS( "DynaPDF.AddBookmark"; $PDF; "1.1 Chimpanzee"; $bookmarkChild; 7; 0 ) ]

See also

Example Databases

This function checks for a license.

Created 18th August 2014, last changed 20th June 2024


DynaPDF.AddAnnotToPage - DynaPDF.AddBookmarkEx