comet.CBookmark

class comet.CBookmark

See also

Module hyperlink

Methods

CBookmark.isValid()

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:

bool

Available:

InDesign® comet_pdf®

CScript:

bookmark::is_valid

CBookmark.getDocument()

Get the document this bookmark belongs to.

Returns:

The document

Return type:

CDocument

Raises:

CometError – On internal error

Available:

InDesign® comet_pdf®

CBookmark.getName()

Get the name of this bookmark.

Returns:

The name

Return type:

str

Raises:

CometError – On internal error

Available:

InDesign® comet_pdf®

CScript:

bookmark::name

CBookmark.setName(name)

Change the name of this bookmark.

Parameters:

name (str) – The new name

Return type:

None

Raises:
Available:

InDesign® comet_pdf®

CScript:

bookmark::change_name

CBookmark.getDepth()

Get the nesting level of this bookmark.

Returns:

The 0-based nesting level

Return type:

int

Raises:

CometError – On internal error

Available:

InDesign® comet_pdf®

CScript:

bookmark::level

CBookmark.getIndex()

Get the index of this bookmark at the local nesting level.

Returns:

The 0-based local index

Return type:

int

Raises:

CometError – On internal error

Available:

InDesign® comet_pdf®

CScript:

bookmark::position

CBookmark.setIndex(index)

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:
Available:

InDesign® comet_pdf®

CScript:

bookmark::change_pos

See also:

setParent()

CBookmark.getParent()

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:

bookmark::parent

CBookmark.setParent(parent, index=-1)

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:

    • CBookmark

      A parent bookmark

    • None

      Move the bookmark to the top level

  • index (int) –

    The new local index.

    The value is clamped to valid values:

    • < 0 or > max index: Last

Return type:

None

Raises:
Available:

InDesign® comet_pdf®

CScript:

bookmark::change_parent

CBookmark.getChildren(recursive=False, name='')

Get childen of this bookmark.

Parameters:
  • recursive (bool) –

    Whether to return only direct children of the entire hierarchy below.

    • True Return all children in depth-first order

    • False : Return direct children only

  • name (str) –

    Only return bookmarks matching this name

    • Empty str: Impose no name restriction

Returns:

The child bookmarks

Return type:

list[CBookmark]

Raises:
Available:

InDesign® comet_pdf®

CScript:

bookmark::parent

CBookmark.setColor(color)

Change the font color of this bookmark.

Parameters:

color (CSwatch) –

The new color.

Must be in color model constants.kColorModelRGB

Return type:

None

Raises:
Available:

comet_pdf®

CScript:

bookmark::change_color

CBookmark.createBookmark(pageDestination, name, index=-1)

Create a new bookmark as a child of this one.

Parameters:
  • pageDestination

    The destination the bookmark points to.

    The parameter type can be:

    • int

      A page index.

    • CPage

      A page. Must be in the same document.

  • name (str) – The name of the bookmark.

  • index (int) –

    The index among the child bookmarks.

    The value is clamped to valid values:

    • < 0 or > max index: Last

Returns:

The newly created bookmark

Return type:

CBookmark

Raises:
Available:

InDesign® comet_pdf®

CScript:
CBookmark.remove()

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:

bookmark::remove

Special methods

CBookmark.__repr__()

String representation.

Returns:

<CBookmark> Name: Name

Document: Document name

Index: Index

Depth: Depth

Example
<CBookmark> Name: Lesezeichen 1
Document: DebugInfoTest.indd
Index: 0
Depth: 0

Return type:

str