comet.CHyperlinkDestination

class comet.CHyperlinkDestination

Methods

CHyperlinkDestination.isValid()

Determine whether the hyperlink destination is still valid and exists

Returns:

Whether the hyperlink destination is still valid and exists

Return type:

bool

Available:

InDesign® comet_pdf®

CScript:

hyperlink::is_valid

CHyperlinkDestination.getDocument()

Get the document the destination belongs to.

Returns:

The owning document

Return type:

CDocument

Raises:

CometError – When the destination is not valid

Available:

InDesign® comet_pdf®

CHyperlinkDestination.getType()

Get the type of the destination.

Returns:

The destination type.

  • 0 : Undefined

  • 1 : URL

  • 2 : External File

  • 3 : Mail (comet_pdf only). InDesign® returns 1 (URL) here too.

  • 4 : Page

  • 5 : Text Anchor

  • 8 : Named Destination (comet_pdf only)

Return type:

int

Raises:

CometError – When the destination is not valid

Available:

InDesign® comet_pdf®

CScript:

hyperlink::type

CHyperlinkDestination.getName()

Get the name of the destination.

This can be useful when the destination is a text anchor or named destination.

Returns:

The name of the destination.

Return type:

str

Raises:

CometError – When the destination is not valid

Available:

InDesign® comet_pdf®

CScript:

hyperlink::name

CHyperlinkDestination.getPageIndex()

Get the page index the destination points to.

Returns:

The target page index

Return type:

int

Raises:
  • TypeError – When the destination does not point to a page

  • CometError – When the destination is not valid

Available:

InDesign® comet_pdf®

CHyperlinkDestination.getURL()

Get the target URL the destination points to.

Returns:

The target URL

Return type:

str

Raises:
  • TypeError – When the destination does not point to an URL

  • CometError – When the destination is not valid

Available:

InDesign® comet_pdf®

CHyperlinkDestination.getTextAnchor()

Get the text anchor in the target text model the destination points to.

Returns:

The target anchor information.

Tuple containing:

Return type:

tuple[CTextModel, int]

Raises:
  • TypeError – When the destination does not point to a text anchor

  • CometError – When the destination is not valid

Available:

InDesign®

Special methods

CHyperlinkDestination.__repr__()

String representation.

Returns:

For getType() == 4 (Page):

<CHyperlinkDestination> Type: Page | Page: Page index

For getType() == 5 (Text anchor) || 6 (Named Destination):

<CHyperlinkDestination> Type: Type: Type | Destination: Destination name

else:

<CHyperlinkDestination> Type: Type: Type | Destination: Destination URL

Examples
<CHyperlinkDestination> Type: Page | Page: 2

<CHyperlinkDestination> Type: Text Anchor | Destination: Anker 1

<CHyperlinkDestination> Type: URL | Destination: http://www.priint.com

Return type:

str