new Bookmark()
A %PDF document may optionally display a document outline on the screen, allowing
the user to navigate interactively from one part of the document to another.
The outline consists of a tree-structured hierarchy of Bookmarks (sometimes
called outline items), which serve as a 'visual table of contents' to display the
document's structure to the user.
Each Bookmark has a title that appears on screen, and an Action that specifies
what happens when a user clicks on the Bookmark. The typical action for a
user-created Bookmark is to move to another location in the current document,
although any action (see PDF::Action) can be specified.
Bookmark is a utility class used to simplify work with %PDF bookmarks (or
outlines; see section 8.2.2 'Document Outline' in %PDF Reference Manual for
more details).
Methods
-
<static> create(in_doc, in_title)
-
Creates a new valid Bookmark with given title in the specified document.
Parameters:
Name Type Description in_doc
Core.PDFNet.PDFDoc | Core.PDFNet.SDFDoc | Core.PDFNet.FDFDoc The document in which a Bookmark is to be created. in_title
string The title string value of the new Bookmark. Returns:
A promise that resolves to the new Bookmark. Note: The new Bookmark is not linked to the outline tree. Use AddChild()/AddNext()/AddPrev() methods in order to link the Bookmark to the outline tree- Type
- Promise.<Core.PDFNet.Bookmark>
-
<static> createFromObj(in_bookmark_dict)
-
A constructor. Creates a Bookmark and initialize it using given Cos/SDF object.
Parameters:
Name Type Description in_bookmark_dict
Core.PDFNet.Obj Pointer to the Cos/SDF object (outline item dictionary). Returns:
A promise that resolves to the new Bookmark. Note: The constructor does not copy any data, but is instead the logical equivalent of a type cast.- Type
- Promise.<Core.PDFNet.Bookmark>
-
addChild(in_bookmark)
-
Adds the specified Bookmark as the new last child of this Bookmark.
Parameters:
Name Type Description in_bookmark
Core.PDFNet.Bookmark The Bookmark object to be added as a last child of this Bookmark. Note: Parameter in_bookmark must not be linked to a bookmark tree. Note: If this Bookmark previously had no children, it will be open after the child is added. Returns:
- Type
- Promise.<void>
-
addNewChild(in_title)
-
Adds a new Bookmark as the new last child of this Bookmark.
Parameters:
Name Type Description in_title
string The title string value of the new Bookmark. Returns:
A promise that resolves to the newly created child Bookmark. Note: If this Bookmark previously had no children, it will be open after the child is added.- Type
- Promise.<Core.PDFNet.Bookmark>
-
addNewNext(in_title)
-
Adds a new Bookmark to the tree containing this Bookmark, as the new right sibling.
Parameters:
Name Type Description in_title
string The title string value of the new Bookmark. Returns:
A promise that resolves to the newly created sibling Bookmark.- Type
- Promise.<Core.PDFNet.Bookmark>
-
addNewPrev(in_title)
-
Adds a new Bookmark to the tree containing this Bookmark, as the new left sibling.
Parameters:
Name Type Description in_title
string The title string value of the new Bookmark. Returns:
A promise that resolves to the newly created sibling Bookmark.- Type
- Promise.<Core.PDFNet.Bookmark>
-
addNext(in_bookmark)
-
Adds the specified Bookmark as the new right sibling to this Bookmark, adjusting the tree containing this Bookmark appropriately.
Parameters:
Name Type Description in_bookmark
Core.PDFNet.Bookmark The Bookmark object to be added to this Bookmark. Note: Parameter in_bookmark must not be linked to a bookmark tree. Returns:
- Type
- Promise.<void>
-
addPrev(in_bookmark)
-
Adds the specified Bookmark as the new left sibling to this Bookmark, adjusting the tree containing this Bookmark appropriately.
Parameters:
Name Type Description in_bookmark
Core.PDFNet.Bookmark The Bookmark object to be added to this Bookmark. Note: Parameter in_bookmark must not be linked to a bookmark tree. Returns:
- Type
- Promise.<void>
-
compare(in_bookmark)
-
Compares two Bookmark objects for equality.
Parameters:
Name Type Description in_bookmark
Core.PDFNet.Bookmark A reference to an existing Bookmark object. Returns:
A promise that resolves to true if the both Bookmarks share the same underlying SDF/Cos object; otherwise false.- Type
- Promise.<boolean>
-
copy()
-
Copy Constructor. Creates a new Bookmark object equal to the existing Bookmark object.
Returns:
A promise that resolves to a new Bookmark object.- Type
- Promise.<Core.PDFNet.Bookmark>
-
delete()
-
Removes the Bookmark's subtree from the bookmark tree containing it.
Returns:
- Type
- Promise.<void>
-
find(in_title)
-
Returns the Bookmark specified by the given title string.
Parameters:
Name Type Description in_title
string The title string value of the Bookmark to find. Returns:
A promise that resolves to a Bookmark matching the title string value specified.- Type
- Promise.<Core.PDFNet.Bookmark>
-
getAction()
-
Returns the Bookmark's action.
Returns:
A promise that resolves to the Bookmark's action.- Type
- Promise.<Core.PDFNet.Action>
-
getColor()
-
Returns the Bookmark's RGB color value. Note: The three numbers \a out_r, \a out_g, and \a out_b are in the range 0.0 to 1.0, representing the components in the DeviceRGB color space of the color to be used for the Bookmark's text. Example: \code double red, green, blue; bookmark.GetColor(red, green, blue); \endcode
Returns:
A promise that resolves to an object of type: "Object"- Type
- Promise.<Object>
-
getFirstChild()
-
Returns the Bookmark's first child.
Returns:
A promise that resolves to the Bookmark's first child.- Type
- Promise.<Core.PDFNet.Bookmark>
-
getFlags()
-
Returns the Bookmark's flags.
Returns:
A promise that resolves to the flags of the Bookmark object. Bit 1 (least-significant bit) indicates italic font whereas bit 2 indicates bold font. Therefore, 0 indicates normal, 1 is italic, 2 is bold, and 3 is bold-italic.- Type
- Promise.<number>
-
getIndent()
-
Returns the indentation level of the Bookmark in its containing tree.
Returns:
A promise that resolves to the indentation level of the Bookmark in its containing tree. Note: The root level has an indentation level of zero.- Type
- Promise.<number>
-
getLastChild()
-
Returns the Bookmark's last child.
Returns:
A promise that resolves to the Bookmark's last child.- Type
- Promise.<Core.PDFNet.Bookmark>
-
getNext()
-
Returns the Bookmark's next (right) sibling.
Returns:
A promise that resolves to the Bookmark's next (right) sibling.- Type
- Promise.<Core.PDFNet.Bookmark>
-
getOpenCount()
-
Returns the number of opened bookmarks in this subtree.
Returns:
A promise that resolves to the number of opened bookmarks in this subtree (not including this Bookmark). If the item is closed, a negative integer whose absolute value specifies how many descendants would appear if the item were reopened.- Type
- Promise.<number>
-
getParent()
-
Returns the Bookmark's parent Bookmark.
Returns:
A promise that resolves to the Bookmark's parent Bookmark.- Type
- Promise.<Core.PDFNet.Bookmark>
-
getPrev()
-
Returns the Bookmark's previous (left) sibling.
Returns:
A promise that resolves to the Bookmark's previous (left) sibling.- Type
- Promise.<Core.PDFNet.Bookmark>
-
getSDFObj()
-
Returns the underlying SDF/Cos object.
Returns:
A promise that resolves to the underlying SDF/Cos object. Note: A null (non-valid) bookmark returns a null object.- Type
- Promise.<Core.PDFNet.Obj>
-
getTitle()
-
Returns the Bookmark's title string.
Returns:
A promise that resolves to the Bookmark's title string).- Type
- Promise.<string>
-
getTitleObj()
-
Returns the Bookmark's title string object.
Returns:
A promise that resolves to the Bookmark's title string object.- Type
- Promise.<Core.PDFNet.Obj>
-
hasChildren()
-
Indicates whether the Bookmark has children.
Returns:
A promise that resolves to true if the Bookmark has children; otherwise false.- Type
- Promise.<boolean>
-
isOpen()
-
Indicates whether the Bookmark is open.
Returns:
A promise that resolves to true if this Bookmark is open; otherwise false. Note: An open Bookmark shows all its children.- Type
- Promise.<boolean>
-
isValid()
-
Indicates whether the Bookmark is valid (non-null).
Returns:
A promise that resolves to true if this is a valid (non-null) Bookmark; otherwise false. Note: If this method returns false the underlying SDF/Cos object is null and the Bookmark object should be treated as null as well.- Type
- Promise.<boolean>
-
removeAction()
-
Removes the Bookmark's action.
Returns:
- Type
- Promise.<void>
-
setAction(in_action)
-
Sets the Bookmark's action.
Parameters:
Name Type Description in_action
Core.PDFNet.Action The new Action for the Bookmark. Returns:
- Type
- Promise.<void>
-
setColor( [in_r] [, in_g] [, in_b])
-
Sets the Bookmark's color value.
Parameters:
Name Type Argument Description in_r
number <optional>
The red component of the color. in_g
number <optional>
The green component of the color. in_b
number <optional>
The blue component of the color. Note: The three numbers \a in_r, \a in_g, and \a in_b are in the range 0.0 to 1.0, representing the components in the DeviceRGB color space of the color to be used for the Bookmark's text. Default color value is black, [0.0 0.0 0.0]. Returns:
- Type
- Promise.<void>
-
setFlags(in_flags)
-
Sets the Bookmark's flags.
Parameters:
Name Type Description in_flags
number The new bookmark flags. Bit 1 (the least-significant bit) indicates italic font whereas bit 2 indicates bold font. Therefore, 0 indicates normal, 1 is italic, 2 is bold, and 3 is bold-italic. Returns:
- Type
- Promise.<void>
-
setOpen(in_open)
-
Opens or closes the Bookmark.
Parameters:
Name Type Description in_open
boolean Boolean value that contains the status. If true, the Bookmark is opened. Otherwise the Bookmark is closed. Note: An opened Bookmark shows its children, while a closed Bookmark does not. Returns:
- Type
- Promise.<void>
-
setTitle(title)
-
Sets the Bookmark's title string.
Parameters:
Name Type Description title
string The new title string for the bookmark. Returns:
- Type
- Promise.<void>
-
unlink()
-
Unlinks this Bookmark from the bookmark tree that contains it, and adjusts the tree appropriately. Note: After the bookmark is unlinked is can be moved to another place in the bookmark tree located in the same document.
Returns:
- Type
- Promise.<void>