All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
pdftron::PDF::Bookmark Class Reference

#include <Bookmark.h>

Public Member Functions

 Bookmark ()
 
 Bookmark (SDF::Obj in_bookmark_dict)
 
 Bookmark (const Bookmark &in_bookmark)
 
Bookmarkoperator= (const Bookmark &in_bookmark)
 
bool operator== (const Bookmark &in_bookmark)
 
bool IsValid () const
 
bool HasChildren ()
 
Bookmark GetNext ()
 
Bookmark GetPrev ()
 
Bookmark GetFirstChild ()
 
Bookmark GetLastChild ()
 
Bookmark GetParent ()
 
Bookmark Find (const UString &in_title)
 
Bookmark AddChild (const UString &in_title)
 
Bookmark AddChild (Bookmark in_bookmark)
 
Bookmark AddNext (const UString &in_title)
 
void AddNext (Bookmark in_bookmark)
 
Bookmark AddPrev (const UString &in_title)
 
void AddPrev (Bookmark in_bookmark)
 
void Delete ()
 
void Unlink ()
 
int GetIndent ()
 
bool IsOpen ()
 
void SetOpen (bool in_open)
 
int GetOpenCount ()
 
UString GetTitle ()
 
SDF::Obj GetTitleObj ()
 
void SetTitle (const UString &title)
 
Action GetAction ()
 
void SetAction (Action in_action)
 
void RemoveAction ()
 
int GetFlags ()
 
void SetFlags (int in_flags)
 
std::vector< double > GetColor ()
 
void GetColor (double &out_r, double &out_g, double &out_b)
 
void SetColor (double in_r=0.0, double in_g=0.0, double in_b=0.0)
 
SDF::Obj GetSDFObj () const
 
ptrdiff_t GetHandleInternal ()
 

Static Public Member Functions

static Bookmark Create (class PDFDoc &in_doc, const UString &in_title)
 
static BookmarkCreateInternal (ptrdiff_t impl)
 

Detailed Description

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

Definition at line 31 of file Bookmark.h.

Constructor & Destructor Documentation

pdftron::PDF::Bookmark::Bookmark ( )

A constructor. Creates a null (non-valid) bookmark.

pdftron::PDF::Bookmark::Bookmark ( SDF::Obj  in_bookmark_dict)

A constructor. Creates a Bookmark and initialize it using given Cos/SDF object.

Parameters
in_bookmark_dictPointer to the Cos/SDF object (outline item dictionary).
Returns
The new Bookmark.
Note
The constructor does not copy any data, but is instead the logical equivalent of a type cast.
pdftron::PDF::Bookmark::Bookmark ( const Bookmark in_bookmark)

Copy constructor. Creates a copy of the given Bookmark object.

Parameters
in_bookmarkA reference to an existing Bookmark object.
Returns
The new Bookmark.

Member Function Documentation

Bookmark pdftron::PDF::Bookmark::AddChild ( const UString in_title)

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

Parameters
in_titleThe title string value of the new Bookmark.
Returns
The newly created child Bookmark.
Note
If this Bookmark previously had no children, it will be open after the child is added.
Bookmark pdftron::PDF::Bookmark::AddChild ( Bookmark  in_bookmark)

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

Parameters
in_bookmarkThe Bookmark object to be added as a last child of this Bookmark.
Note
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.
Bookmark pdftron::PDF::Bookmark::AddNext ( const UString in_title)

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

Parameters
in_titleThe title string value of the new Bookmark.
Returns
The newly created sibling Bookmark.
void pdftron::PDF::Bookmark::AddNext ( Bookmark  in_bookmark)

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

Parameters
in_bookmarkThe Bookmark object to be added to this Bookmark.
Note
Parameter in_bookmark must not be linked to a bookmark tree.
Bookmark pdftron::PDF::Bookmark::AddPrev ( const UString in_title)

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

Parameters
in_titleThe title string value of the new Bookmark.
Returns
The newly created sibling Bookmark.
void pdftron::PDF::Bookmark::AddPrev ( Bookmark  in_bookmark)

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

Parameters
in_bookmarkThe Bookmark object to be added to this Bookmark.
Note
Parameter in_bookmark must not be linked to a bookmark tree.
static Bookmark pdftron::PDF::Bookmark::Create ( class PDFDoc in_doc,
const UString in_title 
)
static

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

Parameters
in_docThe document in which a Bookmark is to be created.
in_titleThe title string value of the new Bookmark.
Returns
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
static Bookmark* pdftron::PDF::Bookmark::CreateInternal ( ptrdiff_t  impl)
static
void pdftron::PDF::Bookmark::Delete ( )

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

Bookmark pdftron::PDF::Bookmark::Find ( const UString in_title)

Returns the Bookmark specified by the given title string.

Parameters
in_titleThe title string value of the Bookmark to find.
Returns
A Bookmark matching the title string value specified.
Action pdftron::PDF::Bookmark::GetAction ( )

Returns the Bookmark's action.

Returns
The Bookmark's action.
std::vector<double> pdftron::PDF::Bookmark::GetColor ( )

Returns the Bookmark's RGB color value.

Parameters
out_rReference to a variable that receives the red component of the color.
out_gReference to a variable that receives the green component of the color.
out_bReference to a variable that receives the blue component of the color.
Note
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.

Example:

double red, green, blue;
bookmark.GetColor(red, green, blue);
void pdftron::PDF::Bookmark::GetColor ( double &  out_r,
double &  out_g,
double &  out_b 
)
Bookmark pdftron::PDF::Bookmark::GetFirstChild ( )

Returns the Bookmark's first child.

Returns
The Bookmark's first child.
int pdftron::PDF::Bookmark::GetFlags ( )

Returns the Bookmark's flags.

Returns
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.
ptrdiff_t pdftron::PDF::Bookmark::GetHandleInternal ( )
int pdftron::PDF::Bookmark::GetIndent ( )

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

Returns
The indentation level of the Bookmark in its containing tree.
Note
The root level has an indentation level of zero.
Bookmark pdftron::PDF::Bookmark::GetLastChild ( )

Returns the Bookmark's last child.

Returns
The Bookmark's last child.
Bookmark pdftron::PDF::Bookmark::GetNext ( )

Returns the Bookmark's next (right) sibling.

Returns
the Bookmark's next (right) sibling.
int pdftron::PDF::Bookmark::GetOpenCount ( )

Returns the number of opened bookmarks in this subtree.

Returns
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.
Bookmark pdftron::PDF::Bookmark::GetParent ( )

Returns the Bookmark's parent Bookmark.

Returns
The Bookmark's parent Bookmark.
Bookmark pdftron::PDF::Bookmark::GetPrev ( )

Returns the Bookmark's previous (left) sibling.

Returns
The Bookmark's previous (left) sibling.
SDF::Obj pdftron::PDF::Bookmark::GetSDFObj ( ) const

Returns the underlying SDF/Cos object.

Returns
The underlying SDF/Cos object.
Note
A null (non-valid) bookmark returns a null object.
UString pdftron::PDF::Bookmark::GetTitle ( )

Returns the Bookmark's title string.

Returns
The Bookmark's title string).
SDF::Obj pdftron::PDF::Bookmark::GetTitleObj ( )

Returns the Bookmark's title string object.

Returns
The Bookmark's title string object.
bool pdftron::PDF::Bookmark::HasChildren ( )

Indicates whether the Bookmark has children.

Returns
True if the Bookmark has children; otherwise false.
bool pdftron::PDF::Bookmark::IsOpen ( )

Indicates whether the Bookmark is open.

Returns
True if this Bookmark is open; otherwise false.
Note
An open Bookmark shows all its children.
bool pdftron::PDF::Bookmark::IsValid ( ) const

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

Returns
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.
Bookmark& pdftron::PDF::Bookmark::operator= ( const Bookmark in_bookmark)

Sets this Bookmark object equal to the specified Bookmark object.

Parameters
in_bookmarkReference to a Bookmark object that is assigned to this Bookmark object.
Returns
This method returns a reference to this Bookmark object to allow cascaded assignments.
bool pdftron::PDF::Bookmark::operator== ( const Bookmark in_bookmark)

Compares two Bookmark objects for equality.

Parameters
in_bookmarkA reference to an existing Bookmark object.
Returns
True if the both Bookmarks share the same underlying SDF/Cos object; otherwise false.
void pdftron::PDF::Bookmark::RemoveAction ( )

Removes the Bookmark's action.

void pdftron::PDF::Bookmark::SetAction ( Action  in_action)

Sets the Bookmark's action.

Parameters
in_actionThe new Action for the Bookmark.
void pdftron::PDF::Bookmark::SetColor ( double  in_r = 0.0,
double  in_g = 0.0,
double  in_b = 0.0 
)

Sets the Bookmark's color value.

Parameters
in_rThe red component of the color.
in_gThe green component of the color.
in_bThe blue component of the color.
Note
The three numbers in_r, in_g, and 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].
void pdftron::PDF::Bookmark::SetFlags ( int  in_flags)

Sets the Bookmark's flags.

Parameters
in_flagsThe 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.
void pdftron::PDF::Bookmark::SetOpen ( bool  in_open)

Opens or closes the Bookmark.

Parameters
in_openBoolean 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.
void pdftron::PDF::Bookmark::SetTitle ( const UString title)

Sets the Bookmark's title string.

Parameters
titleThe new title string for the bookmark.
void pdftron::PDF::Bookmark::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.

The documentation for this class was generated from the following file: