comet.CBookmark¶
- class comet.CBookmark¶
See also
Module hyperlink
Methods¶
- CBookmark.isValid() bool ¶
Determine whether this bookmark is still valid and exists in a document. A bookmark may be invalid e.g. when it is deleted from the owning document by calling
remove()
- Returns:
Whether the frame is still valid
- Return type:
- Available:
InDesign® comet_pdf®
- CScript:
- CBookmark.getDocument() CDocument ¶
Get the document this bookmark belongs to.
- Returns:
The document
- Return type:
- Raises:
CometError – On internal error
- Available:
InDesign® comet_pdf®
- CBookmark.getName() str ¶
Get the name of this bookmark.
- Returns:
The name
- Return type:
- Raises:
CometError – On internal error
- Available:
InDesign® comet_pdf®
- CScript:
- CBookmark.setName(name: str) None ¶
Change the name of this bookmark.
- Parameters:
name (str) – The new name
- Return type:
None
- Raises:
TypeError – When parameter types are invalid
ValueError – When parameter name is empty str
CometError – On internal error
- Available:
InDesign® comet_pdf®
- CScript:
- CBookmark.getDepth() int ¶
Get the nesting level of this bookmark.
- Returns:
The 0-based nesting level
- Return type:
- Raises:
CometError – On internal error
- Available:
InDesign® comet_pdf®
- CScript:
- CBookmark.getIndex() int ¶
Get the index of this bookmark at the local nesting level.
- Returns:
The 0-based local index
- Return type:
- Raises:
CometError – On internal error
- Available:
InDesign® comet_pdf®
- CScript:
- CBookmark.setIndex(index: int) None ¶
Change this bookmark’s index inside the parent level.
- Parameters:
index (int) –
The new local index.
The value is clamped to valid values:
< 0 or > max index: Last
- Return type:
None
- Raises:
TypeError – When parameter types are invalid
CometError – On internal error
- Available:
InDesign® comet_pdf®
- CScript:
- See also:
- CBookmark.getParent() CBookmark | None ¶
Get the parent bookmark of this bookmark.
May return
None
when this bookmark is at the top level.- Returns:
The parent bookmark
- Return type:
CBookmark | None
- Raises:
CometError – On internal error
- Available:
InDesign® comet_pdf®
- CScript:
- CBookmark.setParent(parent: CBookmark | None, index: int = -1) None ¶
Change the parent of this bookmark.
- Parameters:
parent –
The new parent bookmark.
Of course this must be a valid parent, e.g. parenting underneath a child of itself is not possible.
The parameter type can be:
index (int) –
The new local index.
The value is clamped to valid values:
< 0 or > max index: Last
- Return type:
None
- Raises:
TypeError – When parameter types are invalid
CometError – On internal error
- Available:
InDesign® comet_pdf®
- CScript:
- CBookmark.getChildren(recursive: bool = False, name: str = '') list[CBookmark] ¶
Get childen of this bookmark.
- Parameters:
- Returns:
The child bookmarks
- Return type:
- Raises:
TypeError – When parameter types are invalid
CometError – On internal error
- Available:
InDesign® comet_pdf®
- CScript:
- CBookmark.setColor(color: CSwatch) None ¶
Change the font color of this bookmark.
- Parameters:
color (CSwatch) –
The new color.
Must be in color model
constants.kColorModelRGB
- Return type:
None
- Raises:
TypeError – When parameter types are invalid
CometError – On internal error
- Available:
comet_pdf®
- CScript:
- CBookmark.createBookmark(pageDestination: int | CPage, name: str, index: int = -1) CBookmark ¶
Create a new bookmark as a child of this one.
- Parameters:
- Returns:
The newly created bookmark
- Return type:
- Raises:
TypeError – When parameter types are invalid
ValueError – When parameter name is empty
- Available:
InDesign® comet_pdf®
- CScript:
- CBookmark.remove() None ¶
Remove this bookmark from the document.
All subsequent calls to this bookmarks’s functions will fail.
- Return type:
None
- Raises:
CometError – On internal error
- Available:
InDesign® comet_pdf®
- CScript: