Navigation

  • index
  • modules |
  • next |
  • previous |
  • priint:comet Python API 5.0 documentation »
  • API Reference »
  • Classes »
  • comet.CHyperlink

comet.CHyperlink¶

class comet.CHyperlink¶

Methods¶

CHyperlink.isValid()¶

Determine whether this hyperlink destination is still valid and exists.

Returns:

Whether this hyperlink is still valid and exists

Return type:

bool

Available:

InDesign® comet_pdf®

CScript:

hyperlink::is_valid

CHyperlink.getType()¶

Determine the type of the hyperlink.

Returns:

The type of the hyperlink

  • 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 hyperlink is not valid

Available:

InDesign® comet_pdf®

CScript:

hyperlink::type

CHyperlink.getDocument()¶

Get the document this link belongs to.

Returns:

The owning document

Return type:

CDocument

Raises:

CometError – When the hyperlink is not valid

Available:

InDesign® comet_pdf®

CHyperlink.getSource()¶

Get the source attached to this link.

Returns:

The source of this link

Return type:

CHyperlinkSource

Raises:

CometError – When the hyperlink is not valid

Available:

InDesign® comet_pdf®

CHyperlink.getDestination()¶

Get the destination this hyperlink points to.

Returns:

The target destination

Return type:

CHyperlinkDestination

Raises:

CometError – When the hyperlink is not valid

Available:

InDesign® comet_pdf®

CScript:

hyperlink::destination

CHyperlink.getName()¶

Determine the name of the hyperlink.

Returns:

The name of the hyperlink

Return type:

str

Raises:

CometError – When the hyperlink is not valid

Available:

InDesign® comet_pdf®

CScript:

hyperlink::name

CHyperlink.setName(name)¶

Set the name of the hyperlink.

Parameters:

name (str) – The new name

Return type:

None

Raises:
  • TypeError – When parameter types are invalid

  • ValueError – When parameter name is empty

  • CometError –

    • When the hyperlink is not valid

    • On internal error

Available:

InDesign® comet_pdf®

CScript:

hyperlink::setname

CHyperlink.getVisible()¶

Determine whether the hyperlink border is visible.

Returns:

Whether the hyperlink is visible

Return type:

bool

Raises:

CometError – When the hyperlink is not valid

Available:

InDesign® comet_pdf®

CScript:

hyperlink::visible

CHyperlink.setVisible(visible)¶

Set the border visibility of the hyperlink.

Parameters:

visible (bool) – The new visibility state

Return type:

bool

Raises:
  • TypeError – When parameter types are invalid

  • CometError – When the hyperlink is not valid

Available:

InDesign® comet_pdf®

CScript:
  • hyperlink::show

  • hyperlink::hide

CHyperlink.getColor()¶

Get the color of the hyperlink border.

Returns:

The color of the hyperlink border

Return type:

CSwatch

Raises:

CometError – When the hyperlink is not valid

Available:

InDesign®

CScript:

hyperlink::color

CHyperlink.setColor(color)¶

Set the color of the hyperlink border.

Parameters:

color –

The new hyperlink border color.

The parameter type can be:

  • CColor

    Color with space RGB, CMYK or LAB

  • CSwatch

    Swatch

    Must belong to the same document as the hyperlink

Return type:

None

Raises:
  • TypeError – When parameter types are invalid

  • ValueError –

    • When parameter color is CColor and has unsupported type

    • When parameter color is CSwatch and is from a different document

  • CometError –

    • When the hyperlink is not valid

    • On internal error

Available:

InDesign®

CScript:

hyperlink::appearance

CHyperlink.getBorderWidth()¶

Get the width of the hyperlink border.

Returns:

The width setting of the border

Return type:

int

Raises:

CometError – When the hyperlink is not valid

Available:

InDesign®

CScript:

hyperlink::borderwidth

CHyperlink.setBorderWidth(width)¶

Set the width of the hyperlink border.

Parameters:

width (int) – The width setting

Return type:

None

Raises:
  • TypeError – When parameter types are invalid

  • ValueError – When parameter width has invalid value

  • CometError –

    • When the hyperlink is not valid

    • On internal error

Available:

InDesign®

CScript:

hyperlink::appearance

CHyperlink.getHilight()¶

Get the hilight state of the hyperlink.

The hilight state is not used in InDesign® , it only matters when the file is exported to PDF.

To change the visibility of the hyperlink, please use setVisible()

Returns:

The hilight state

Return type:

int

Raises:

CometError – When the hyperlink is not valid

Available:

InDesign®

CScript:

hyperlink::hilight

CHyperlink.setHilight(hilight)¶

Set the hilight state of the hyperlink.

The hilight state is not used in InDesign® , it only matters when the file is exported to PDF.

To change the visibility of the hyperlink, please use setVisible()

Parameters:

hilight (int) – The new hilight state

Return type:

None

Raises:
  • TypeError – When parameter types are invalid

  • ValueError – When parameter hilight has invalid value

  • CometError – When the hyperlink is not valid

Available:

InDesign®

CScript:

hyperlink::appearance

CHyperlink.getOutlineStyle()¶

Get the outline style of the hyperlink.

Returns:

The outline style of the hyperlink

  • 0: Solid

  • 1: Dashed

Return type:

int

Raises:

CometError – When the hyperlink is not valid

Available:

InDesign®

CHyperlink.setOutlineStyle(style)¶

Set the outline style of the hyperlink.

Parameters:

style (int) –

The new outline style

  • 0: Solid

  • 1: Dashed

Return type:

None

Raises:
  • TypeError – When parameter types are invalid

  • ValueError – When parameter style has invalid value

  • CometError – When the hyperlink is not valid

Available:

InDesign®

CScript:

hyperlink::appearance

CHyperlink.remove()¶

Remove this hyperlink from the document.

The object will be left in an invalid state.

Return type:

None

Raises:

CometError – When the hyperlink is not valid

Available:

InDesign® comet_pdf®

CScript:

hyperlink::delete_

Special methods¶

CHyperlink.__repr__()¶

String representation.

Returns:

<CHyperlink> Name: Name

Example¶
<CHyperlink> Name: text1

Return type:

str

Table of Contents

  • comet.CHyperlink
    • comet.CHyperlink
    • Methods
      • CHyperlink.isValid()
      • CHyperlink.getType()
      • CHyperlink.getDocument()
      • CHyperlink.getSource()
      • CHyperlink.getDestination()
      • CHyperlink.getName()
      • CHyperlink.setName()
      • CHyperlink.getVisible()
      • CHyperlink.setVisible()
      • CHyperlink.getColor()
      • CHyperlink.setColor()
      • CHyperlink.getBorderWidth()
      • CHyperlink.setBorderWidth()
      • CHyperlink.getHilight()
      • CHyperlink.setHilight()
      • CHyperlink.getOutlineStyle()
      • CHyperlink.setOutlineStyle()
      • CHyperlink.remove()
    • Special methods
      • CHyperlink.__repr__()

Previous topic

comet.CGroup

Next topic

comet.CHyperlinkDestination

This Page

  • Show Source

Quick search

© Copyright 2025, WERK II Medien- und Informationsgesellschaft mbH. Created using Sphinx 8.0.2.