Class: Bookmark

PDFNet. Bookmark


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 PDFNet.PDFDoc | PDFNet.SDFDoc | 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.
Type
Promise.<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 PDFNet.Obj Pointer to the Cos/SDF object (outline item dictionary).
Returns:
A promise that resolves to the new Bookmark.
Type
Promise.<PDFNet.Bookmark>

addChild(in_bookmark)

adds the specified Bookmark as the new last child of this Bookmark.
Parameters:
Name Type Description
in_bookmark PDFNet.Bookmark The Bookmark object to be added as a last child of this Bookmark.
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.
Type
Promise.<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.<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.<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 PDFNet.Bookmark The Bookmark object to be added to this Bookmark.
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 PDFNet.Bookmark The Bookmark object to be added to this Bookmark.
Returns:
Type
Promise.<void>

compare(in_bookmark)

Compares two Bookmark objects for equality.
Parameters:
Name Type Description
in_bookmark 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.<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.<PDFNet.Bookmark>

getAction()

Returns the Bookmark's action.
Returns:
A promise that resolves to the Bookmark's action.
Type
Promise.<PDFNet.Action>

getColor()

Returns the Bookmark's RGB color value.
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.<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.
Type
Promise.<number>

getLastChild()

Returns the Bookmark's last child.
Returns:
A promise that resolves to the Bookmark's last child.
Type
Promise.<PDFNet.Bookmark>

getNext()

Returns the Bookmark's next (right) sibling.
Returns:
A promise that resolves to the Bookmark's next (right) sibling.
Type
Promise.<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.<PDFNet.Bookmark>

getPrev()

Returns the Bookmark's previous (left) sibling.
Returns:
A promise that resolves to the Bookmark's previous (left) sibling.
Type
Promise.<PDFNet.Bookmark>

getSDFObj()

Returns the underlying SDF/Cos object.
Returns:
A promise that resolves to the underlying SDF/Cos object.
Type
Promise.<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.<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.
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.
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 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.
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.
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>

unlinks this Bookmark from the bookmark tree that contains it, and adjusts the tree appropriately.
Returns:
Type
Promise.<void>