Show / Hide Table of Contents

Class 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).

Inheritance
System.Object
Bookmark
Implements
System.IDisposable
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ToString()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: pdftron.PDF
Assembly: PDFNetAndroid.dll
Syntax
public class Bookmark : IDisposable

Constructors

Bookmark(Obj)

A constructor. Creates a bookmark from specified SDF.Obj

Declaration
public Bookmark(Obj b)
Parameters
Type Name Description
Obj b

SDF.Obj object

Methods

AddChild(Bookmark)

Adds the specified Bookmark as the new last child of this Bookmark.

Declaration
public void AddChild(Bookmark bookmark)
Parameters
Type Name Description
Bookmark bookmark

The Bookmark object to be added as a last child of this Bookmark.

Remarks

Parameter in_bookmark must not be linked to a bookmark tree. If this Bookmark previously had no children, it will be open after the child is added.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

AddChild(String)

Adds a new Bookmark as the new last child of this Bookmark.

Declaration
public Bookmark AddChild(string text)
Parameters
Type Name Description
System.String text

The title string value of the new Bookmark.

Returns
Type Description
Bookmark

The newly created child Bookmark.

Remarks

If this Bookmark previously had no children, it will be open after the child is added.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

AddNext(Bookmark)

Adds the specified Bookmark as the new right sibling to this Bookmark, adjusting the tree containing this Bookmark appropriately.

Declaration
public void AddNext(Bookmark bookmark)
Parameters
Type Name Description
Bookmark bookmark

The Bookmark object to be added to this Bookmark.

Remarks

Parameter in_bookmark must not be linked to a bookmark tree.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

AddNext(String)

Adds a new Bookmark to the tree containing this Bookmark, as the new right sibling.

Declaration
public Bookmark AddNext(string text)
Parameters
Type Name Description
System.String text

The title string value of the new Bookmark.

Returns
Type Description
Bookmark

The newly created sibling Bookmark.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

AddPrev(Bookmark)

Adds the specified Bookmark as the new left sibling to this Bookmark, adjusting the tree containing this Bookmark appropriately.

Declaration
public void AddPrev(Bookmark bookmark)
Parameters
Type Name Description
Bookmark bookmark

The Bookmark object to be added to this Bookmark.

Remarks

Parameter in_bookmark must not be linked to a bookmark tree.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

AddPrev(String)

Adds a new Bookmark to the tree containing this Bookmark, as the new left sibling.

Declaration
public Bookmark AddPrev(string text)
Parameters
Type Name Description
System.String text

The title string value of the new Bookmark.

Returns
Type Description
Bookmark

The newly created sibling Bookmark.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Create(PDFDoc, String)

Creates a new valid Bookmark with given title in the specified document.

Declaration
public static Bookmark Create(PDFDoc doc, string text)
Parameters
Type Name Description
PDFDoc doc

The document in which a Bookmark is to be created.

System.String text

The title string value of the new Bookmark.

Returns
Type Description
Bookmark

The new Bookmark.

Remarks

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

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

CreateInternal(IntPtr, Object)

Create a new object using native impl pointer For internal use only.

Declaration
public static Bookmark CreateInternal(IntPtr imp, object reference)
Parameters
Type Name Description
System.IntPtr imp

impl pointer from PDFNet core.

System.Object reference
Returns
Type Description
Bookmark

Delete()

Removes the Bookmark's subtree from the bookmark tree containing it.

Declaration
public void Delete()
Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Dispose()

Declaration
public void Dispose()

Dispose(Boolean)

Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type Name Description
System.Boolean disposing

Equals(Object)

Check whether the given object is the equal to this Bookmark object

Declaration
public override bool Equals(object o)
Parameters
Type Name Description
System.Object o

a given Object

Returns
Type Description
System.Boolean

true, if equals to the given object

Overrides
System.Object.Equals(System.Object)

Finalize()

Releases all resources used by the Bookmark

Declaration
protected void Finalize()

Find(String)

Gets the Bookmark specified by the given title string.

Declaration
public Bookmark Find(string title)
Parameters
Type Name Description
System.String title

The title string value of the Bookmark to find.

Returns
Type Description
Bookmark

A Bookmark matching the title string value specified.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetAction()

Gets the Bookmark's action.

Declaration
public Action GetAction()
Returns
Type Description
Action

The bookmark’s action.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetColor(Double, Double, Double)

Gets the Bookmark's RGB color value.

Declaration
public void GetColor(double out_r, double out_g, double out_b)
Parameters
Type Name Description
System.Double out_r

red component in the DeviceRGB color space

System.Double out_g

green component in the DeviceRGB color space

System.Double out_b

blue component in the DeviceRGB color space

Examples

The three numbers out_r, out_g, and 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.

double red, green, blue;
bookmark.GetColor(red, green, blue);
Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetFirstChild()

Returns the Bookmark's first child.

Declaration
public Bookmark GetFirstChild()
Returns
Type Description
Bookmark

The Bookmark’s first child.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetFlags()

Gets the Bookmark's flags.

Declaration
public int GetFlags()
Returns
Type Description
System.Int32

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.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetHandleInternal()

Declaration
public IntPtr GetHandleInternal()
Returns
Type Description
System.IntPtr

GetIndent()

Gets the indentation level of the Bookmark in its containing tree.

Declaration
public int GetIndent()
Returns
Type Description
System.Int32

The indentation level of the Bookmark in its containing tree.

Remarks

The root level has an indentation level of zero.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetLastChild()

Returns the Bookmark's last child.

Declaration
public Bookmark GetLastChild()
Returns
Type Description
Bookmark

The Bookmark’s last child.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetNext()

Returns the Bookmark's next (right) sibling.

Declaration
public Bookmark GetNext()
Returns
Type Description
Bookmark

The Bookmark’s next (right) sibling.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetOpenCount()

Gets the number of opened bookmarks in this subtree.

Declaration
public int GetOpenCount()
Returns
Type Description
System.Int32

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.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetParent()

Returns the Bookmark's parent Bookmark.

Declaration
public Bookmark GetParent()
Returns
Type Description
Bookmark

The Bookmark’s parent Bookmark.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetPrev()

Returns the Bookmark's previous (left) sibling.

Declaration
public Bookmark GetPrev()
Returns
Type Description
Bookmark

The Bookmark’s previous (left) sibling.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetRefHandleInternal()

Declaration
public object GetRefHandleInternal()
Returns
Type Description
System.Object

GetSDFObj()

Returns the underlying SDF/Cos object.

Declaration
public Obj GetSDFObj()
Returns
Type Description
Obj

The underlying SDF/Cos object.

Remarks

A null (non-valid) bookmark returns a null object.

GetTitle()

Gets the Bookmark's title string.

Declaration
public string GetTitle()
Returns
Type Description
System.String

The Bookmark’s title string).

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

GetTitleObj()

Gets the Bookmark's title string object.

Declaration
public Obj GetTitleObj()
Returns
Type Description
Obj

The Bookmark's title string object.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

HasChildren()

Indicates whether the Bookmark has children.

Declaration
public bool HasChildren()
Returns
Type Description
System.Boolean

True if the Bookmark has children; otherwise false.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

IsOpen()

Indicates whether the Bookmark is open.

Declaration
public bool IsOpen()
Returns
Type Description
System.Boolean

True if this Bookmark is open; otherwise false.

Remarks

An open Bookmark shows all its children.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

IsValid()

Indicates whether the Bookmark is valid (non-null).

Declaration
public bool IsValid()
Returns
Type Description
System.Boolean

True if this is a valid (non-null) Bookmark; otherwise false.

Remarks

If this method returns false the underlying SDF/Cos object is null and the Bookmark object should be treated as null as well.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

op_Assign(Bookmark)

Assignment Operator

Declaration
public Bookmark op_Assign(Bookmark r)
Parameters
Type Name Description
Bookmark r

a Bookmark object

Returns
Type Description
Bookmark

A Bookmark object equals to the specified Bookmark object

RemoveAction()

Removes the Bookmark’s action.

Declaration
public void RemoveAction()
Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Set(Bookmark)

Sets value to the specified Bookmark

Declaration
public void Set(Bookmark p)
Parameters
Type Name Description
Bookmark p

given Bookmark object

SetAction(Action)

Sets the Bookmark’s action.

Declaration
public void SetAction(Action action)
Parameters
Type Name Description
Action action

The new Action for the Bookmark.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

SetColor(Double, Double, Double)

Sets the color.

Declaration
public void SetColor(double r, double g, double b)
Parameters
Type Name Description
System.Double r

red component in the DeviceRGB color space

System.Double g

green component in the DeviceRGB color space

System.Double b

blue component in the DeviceRGB color space

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

SetFlags(Int32)

Sets the Bookmark's flags.

Declaration
public void SetFlags(int flags)
Parameters
Type Name Description
System.Int32 flags

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.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

SetOpen(Boolean)

Opens or closes the Bookmark.

Declaration
public void SetOpen(bool is_open)
Parameters
Type Name Description
System.Boolean is_open

If true, the Bookmark is opened. Otherwise the Bookmark is closed.

Remarks

An opened Bookmark shows its children, while a closed Bookmark does not.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

SetTitle(String)

Sets the Bookmark’s title string.

Declaration
public void SetTitle(string title)
Parameters
Type Name Description
System.String title

The new title string for the bookmark.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Unlink()

Unlinks this Bookmark from the bookmark tree that contains it, and adjusts the tree appropriately.

Declaration
public void Unlink()
Remarks

After the bookmark is unlinked is can be moved to another place in the bookmark tree located in the same document.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Operators

Equality(Bookmark, Bookmark)

Euqality operator checks whether two Bookmark objects are equal

Declaration
public static bool operator ==(Bookmark l, Bookmark r)
Parameters
Type Name Description
Bookmark l

Bookmark object at the left of the operator

Bookmark r

Bookmark object at the right of the operator

Returns
Type Description
System.Boolean

true, if both Bookmark objects are equal, false otherwise.

Inequality(Bookmark, Bookmark)

Ineuqality operator checks whether two Bookmark objects are different

Declaration
public static bool operator !=(Bookmark l, Bookmark r)
Parameters
Type Name Description
Bookmark l

Bookmark object at the left of the operator

Bookmark r

Bookmark object at the right of the operator

Returns
Type Description
System.Boolean

true, if both Bookmark objects are not equal, false otherwise

Implements

System.IDisposable
In This Article
Back to top Generated by DocFX