PTBookmark
@interface PTBookmark : NSObject
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).
-
Creates a new valid Bookmark with given title in the specified document.
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
Declaration
Objective-C
+ (PTBookmark *)Create:(PTPDFDoc *)in_doc in_title:(NSString *)in_title;
Swift
class func create(_ in_doc: PTPDFDoc!, in_title: String!) -> PTBookmark!
Parameters
in_doc
The document in which a Bookmark is to be created.
in_title
The title string value of the new Bookmark.
Return Value
The new Bookmark.
-
A constructor. Creates a null (non-valid) bookmark.
Declaration
Objective-C
- (instancetype)init;
Swift
init!()
-
Undocumented
Declaration
Objective-C
- (BOOL)isEqualTo: (PTBookmark*)in_bookmark;
Swift
func isEqual(to in_bookmark: PTBookmark!) -> Bool
-
Indicates whether the Bookmark is valid (non-null).
Note
If this method returns false the underlying SDF/Cos object is null and the Bookmark object should be treated as null as well.
Declaration
Objective-C
- (BOOL)IsValid;
Swift
func isValid() -> Bool
Return Value
True if this is a valid (non-null) Bookmark; otherwise false.
-
Indicates whether the Bookmark has children.
Declaration
Objective-C
- (BOOL)HasChildren;
Swift
func hasChildren() -> Bool
Return Value
True if the Bookmark has children; otherwise false.
-
Returns the Bookmark’s next (right) sibling.
Declaration
Objective-C
- (PTBookmark *)GetNext;
Swift
func getNext() -> PTBookmark!
Return Value
the Bookmark’s next (right) sibling.
-
Returns the Bookmark’s previous (left) sibling.
Declaration
Objective-C
- (PTBookmark *)GetPrev;
Swift
func getPrev() -> PTBookmark!
Return Value
The Bookmark’s previous (left) sibling.
-
Returns the Bookmark’s first child.
Declaration
Objective-C
- (PTBookmark *)GetFirstChild;
Swift
func getFirstChild() -> PTBookmark!
Return Value
The Bookmark’s first child.
-
Returns the Bookmark’s last child.
Declaration
Objective-C
- (PTBookmark *)GetLastChild;
Swift
func getLastChild() -> PTBookmark!
Return Value
The Bookmark’s last child.
-
Returns the Bookmark’s parent Bookmark.
Declaration
Objective-C
- (PTBookmark *)GetParent;
Swift
func getParent() -> PTBookmark!
Return Value
The Bookmark’s parent Bookmark.
-
Returns the Bookmark specified by the given title string.
Declaration
Objective-C
- (PTBookmark *)Find:(NSString *)in_title;
Swift
func find(_ in_title: String!) -> PTBookmark!
Parameters
in_title
The title string value of the Bookmark to find.
Return Value
A Bookmark matching the title string value specified.
-
Adds a new Bookmark as the new last child of this Bookmark.
Note
If this Bookmark previously had no children, it will be open after the child is added.
Declaration
Objective-C
- (PTBookmark *)AddChildWithTitle:(NSString *)in_title;
Swift
func addChild(withTitle in_title: String!) -> PTBookmark!
Parameters
in_title
The title string value of the new Bookmark.
Return Value
The newly created child Bookmark.
-
Adds the specified Bookmark as the new 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.
Declaration
Objective-C
- (PTBookmark *)AddChildWithBookmark:(PTBookmark *)in_bookmark;
Swift
func addChild(with in_bookmark: PTBookmark!) -> PTBookmark!
Parameters
in_bookmark
The Bookmark object to be added as a last child of this Bookmark.
-
Adds a new Bookmark to the tree containing this Bookmark, as the new right sibling.
Declaration
Objective-C
- (PTBookmark *)AddNextWithTitle:(NSString *)in_title;
Swift
func addNext(withTitle in_title: String!) -> PTBookmark!
Parameters
in_title
The title string value of the new Bookmark.
Return Value
The newly created sibling Bookmark.
-
Adds the specified Bookmark as the new right sibling to this Bookmark, adjusting the tree containing this Bookmark appropriately.
Note
Parameter in_bookmark must not be linked to a bookmark tree.
Declaration
Objective-C
- (void)AddNextWithBookmark:(PTBookmark *)in_bookmark;
Swift
func addNext(with in_bookmark: PTBookmark!)
Parameters
in_bookmark
The Bookmark object to be added to this Bookmark.
-
Adds a new Bookmark to the tree containing this Bookmark, as the new left sibling.
Declaration
Objective-C
- (PTBookmark *)AddPrevWithTitle:(NSString *)in_title;
Swift
func addPrev(withTitle in_title: String!) -> PTBookmark!
Parameters
in_title
The title string value of the new Bookmark.
Return Value
The newly created sibling Bookmark.
-
Adds the specified Bookmark as the new left sibling to this Bookmark, adjusting the tree containing this Bookmark appropriately.
Note
Parameter in_bookmark must not be linked to a bookmark tree.
Declaration
Objective-C
- (void)AddPrevWithBookmark:(PTBookmark *)in_bookmark;
Swift
func addPrev(with in_bookmark: PTBookmark!)
Parameters
in_bookmark
The Bookmark object to be added to this Bookmark.
-
Removes the Bookmark’s subtree from the bookmark tree containing it.
Declaration
Objective-C
- (void)Delete;
Swift
func delete()
-
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.Declaration
Objective-C
- (void)Unlink;
Swift
func unlink()
-
Returns the indentation level of the Bookmark in its containing tree.
Note
The root level has an indentation level of zero.
Declaration
Objective-C
- (int)GetIndent;
Swift
func getIndent() -> Int32
Return Value
The indentation level of the Bookmark in its containing tree.
-
Indicates whether the Bookmark is open.
Note
An open Bookmark shows all its children.
Declaration
Objective-C
- (BOOL)IsOpen;
Swift
func isOpen() -> Bool
Return Value
True if this Bookmark is open; otherwise false.
-
Opens or closes the Bookmark.
Note
An opened Bookmark shows its children, while a closed Bookmark does not.
Declaration
Objective-C
- (void)SetOpen:(BOOL)in_open;
Swift
func setOpen(_ in_open: Bool)
Parameters
in_open
Boolean value that contains the status. If true, the Bookmark is opened. Otherwise the Bookmark is closed.
-
Returns the number of opened bookmarks in this subtree.
Declaration
Objective-C
- (int)GetOpenCount;
Swift
func getOpenCount() -> Int32
Return Value
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.
-
Returns the Bookmark’s title string.
Declaration
Objective-C
- (NSString *)GetTitle;
Swift
func getTitle() -> String!
Return Value
The Bookmark’s title string).
-
Sets the Bookmark’s title string.
Declaration
Objective-C
- (void)SetTitle:(NSString *)title;
Swift
func setTitle(_ title: String!)
Parameters
title
The new title string for the bookmark.
-
Removes the Bookmark’s action.
Declaration
Objective-C
- (void)RemoveAction;
Swift
func removeAction()
-
Returns the Bookmark’s flags.
Declaration
Objective-C
- (int)GetFlags;
Swift
func getFlags() -> Int32
Return Value
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.
-
Sets the Bookmark’s flags.
Declaration
Objective-C
- (void)SetFlags:(int)in_flags;
Swift
func setFlags(_ in_flags: Int32)
Parameters
in_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.
-
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
Declaration
Objective-C
- (NSMutableArray *)GetColor;
Swift
func getColor() -> NSMutableArray!
Parameters
out_r
Reference to a variable that receives the red component of the color.
out_g
Reference to a variable that receives the green component of the color.
out_b
Reference to a variable that receives the blue component of the color.
-
Sets the Bookmark’s color value.
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].
Declaration
Objective-C
- (void)SetColor:(double)in_r in_g:(double)in_g in_b:(double)in_b;
Swift
func setColor(_ in_r: Double, in_g: Double, in_b: Double)
Parameters
in_r
The red component of the color.
in_g
The green component of the color.
in_b
The blue component of the color.
-
Undocumented
Declaration
Objective-C
+ (PTBookmark*)CreateInternal: (unsigned long long)impl;
Swift
class func createInternal(_ impl: UInt64) -> PTBookmark!
-
Undocumented
Declaration
Objective-C
- (unsigned long long)GetHandleInternal;
Swift
func getHandleInternal() -> UInt64