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).
Implements
Inherited Members
Namespace: pdftron.PDF
Assembly: PDFTronDotNet.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 |
|
Methods
AddChild(string)
Adds a new Bookmark as the new last child of this Bookmark.
Declaration
public Bookmark AddChild(string text)
Parameters
| Type | Name | Description |
|---|---|---|
| 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 |
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 |
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 |
|---|---|---|
| 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 |
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 |
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 |
|---|---|---|
| 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 |
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. |
| 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 |
|---|---|---|
| IntPtr | imp | impl pointer from PDFNet core. |
| 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()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
Dispose(bool)
Declaration
protected virtual void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | 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 |
|---|---|---|
| object | o | a given |
Returns
| Type | Description |
|---|---|
| bool | true, if equals to the given object |
Overrides
~Bookmark()
Releases all resources used by the Bookmark
Declaration
protected ~Bookmark()
Find(string)
Gets the Bookmark specified by the given title string.
Declaration
public Bookmark Find(string title)
Parameters
| Type | Name | Description |
|---|---|---|
| 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(ref double, ref double, ref double)
Gets the Bookmark's RGB color value.
Declaration
public void GetColor(ref double out_r, ref double out_g, ref double out_b)
Parameters
| Type | Name | Description |
|---|---|---|
| double | out_r | red component in the DeviceRGB color space |
| double | out_g | green component in the DeviceRGB color space |
| 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 |
|---|---|
| int | 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 |
|---|---|
| IntPtr |
GetIndent()
Gets the indentation level of the Bookmark in its containing tree.
Declaration
public int GetIndent()
Returns
| Type | Description |
|---|---|
| int | 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 |
|---|---|
| int | 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 |
|---|---|
| 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 |
|---|---|
| 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 |
|---|---|
| bool | 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 |
|---|---|
| bool | 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 |
|---|---|
| bool | 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 |
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 |
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 |
|---|---|---|
| double | r | red component in the DeviceRGB color space |
| double | g | green component in the DeviceRGB color space |
| double | b | blue component in the DeviceRGB color space |
Exceptions
| Type | Condition |
|---|---|
| PDFNetException | PDFNetException the PDFNet exception |
SetFlags(int)
Sets the Bookmark's flags.
Declaration
public void SetFlags(int flags)
Parameters
| Type | Name | Description |
|---|---|---|
| int | 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(bool)
Opens or closes the Bookmark.
Declaration
public void SetOpen(bool is_open)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | 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 |
|---|---|---|
| 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 |
op_Assign(Bookmark)
Assignment Operator
Declaration
public Bookmark op_Assign(Bookmark r)
Parameters
| Type | Name | Description |
|---|---|---|
| Bookmark | r | a |
Returns
| Type | Description |
|---|---|
| Bookmark | A |
Operators
operator ==(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 | r |
|
Returns
| Type | Description |
|---|---|
| bool | true, if both |
operator !=(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 | r |
|
Returns
| Type | Description |
|---|---|
| bool | true, if both |