Adds a bookmark pointing to the current page.

 

   
Syntax
 
     

BookmarkID = Doc.AddBookmark(Path, Open)

 

   
Params
 
     
Name   Type   Description
Path String

The path to the bookmark.

Open Boolean Whether the bookmark should be displayed open (expanded) or closed (collapsed).
BookmarkID Long The Object ID of the newly added Bookmark Object.

 

   
Notes
 
     

Adds a bookmark which points to the current page.

Bookmarks are specified as paths in much the same way as file paths. Headings and subheadings are separated by a backslash character. For example:

"1. Introduction\1.1 Aim and Methods\1.1.3 Diagrams"

When a bookmark is added, intermediate headings and subheadings will be created if they do not already exist.

To add multiple bookmarks all referring to the same page simply call the AddBookmark function multiple times.

This function returns the Object ID of the newly added Bookmark Object.

 

   
Example
 
     

The following code adds a sequence of pages with a nested sequence of bookmarks. The image shows the appearance of the document outline. Note that none of the subject pages are visible because the chapter pages were added in a collapsed state.

Set theDoc = Server.CreateObject("ABCpdf3.Doc")
theDoc.FontSize = 64
For i = 1 To 3
  theDoc.Page = theDoc.AddPage()
  theSection = i & " Section"
  theDoc.AddText theSection
  theDoc.AddBookmark theSection, True
  For j = 1 To 5
    theDoc.Page = theDoc.AddPage()
    theChapter = theSection & "\" & j & " Chapter"
    theDoc.AddText theChapter
    theDoc.AddBookmark theChapter, False
    For k = 1 To 6
      theDoc.Page = theDoc.AddPage()
      theSubject = theChapter & "\" & k & " Subject"
      theDoc.AddText theSubject
      theDoc.AddBookmark theSubject, True
    Next
  Next
Next
theDoc.Save "c:\mypdfs\docaddbookmark.pdf
"


docaddbookmark.pdf

 

   

 

Browser Based Help. Published by chm2web software.