Navigation

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

comet.CLink¶

class comet.CLink¶

This section describes all functions for the comet.CLink class.

A CLink object describes a placeholder which is set inside a document.

A single CLink object corresponds to a single text placeholder or frame placeholder. CLink objects provide queries for getting placeholder information, product information and content they can access like text or images.

See also

Module link

Functionality for fetching document links

Methods¶

CLink.getFrame()¶

Get the frame this link belongs to.

InDesign® comet_pdf® For text placeholders this is the containing frame. When the text placeholder is (partially) in overset, the return value is the first frame of the text chain, else it is the text frame which fully contains the link.

Returns:

The frame

Return type:

CFrame

Available:

InDesign® comet_pdf®

CScript:

link::frame

CLink.getLayer()¶

Get the layer this link is on.

Returns:

The layer

Return type:

CLayer

Available:

InDesign® comet_pdf®

CScript:

link::layer

CLink.getType()¶

Get the type of this link.

Returns:

The link type. One of Link types

Return type:

int

Available:

InDesign® comet_pdf®

CLink.getRecordID()¶

Gets the record ID of the link.

Returns:

The ID

Return type:

CIDType

Available:

InDesign® comet_pdf®

CScript:
  • link::id

  • link::id2

  • link::id3

  • link::sid

CLink.getPlaceHolderID()¶

Get the ID of the placeholder of this link.

Returns:

The placeholder ID

Return type:

int

Available:

InDesign® comet_pdf®

CScript:

link::placeholderid

CLink.getPosition()¶

Get the text start position for this link. For frame placeholders the result is always 0.

Returns:

The start position

Return type:

int

Available:

InDesign® comet_pdf®

CScript:

link::pos

CLink.getLength()¶

Get the text length of the link in the document. For frame placeholders the result is always -1.

Returns:

The text length this link governs

Return type:

int

Available:

InDesign® comet_pdf®

CScript:

link::length

CLink.getContent(position=0, length=-1, format=0)¶

Get the text of the link.

Parameters:
  • position (int) –

    Start position.

    Only evaluated for frame placeholders.

  • length (int) –

    Number of characters to fetch.

    Default is constants.kEnd == until the end.

    Only evaluated for frame placeholders.

  • format (int) –

    The export format.

    One of Text formats.

Returns:

The link’s text

Return type:

str

Raises:
  • TypeError – When parameter types are invalid

  • ValueError – When parameter position, length or format has invalid Value

  • CometError – On internal error

Available:

InDesign® comet_pdf®

See also:

CFrame.getText()

CScript:

link::content

CLink.getSyncState()¶

Get the sync state of the link.

Returns:

The link’s sync state. One of Sync states

Return type:

int

Available:

InDesign® comet_pdf®

CScript:

link::sync

CLink.getFuncVars(actionType)¶

Get the function variables of the link.

Parameters:

actionType (int) –

The action to get the function variables for.

One of Action types

Returns:

Funcvars as key/value pairs

Return type:

list[tuple[str, str]]

Raises:
  • TypeError – When parameter types are invalid

  • ValueError – When parameter actionType has invalid Value

  • CometError – On internal error

Available:

InDesign® comet_pdf®

CScript:
  • link::count_funcvars

  • link::get_nth_funcvar

CLink.getPrefix()¶

Get the current prefix of the placeholder.

Returns:

The prefix

Return type:

str

Available:

InDesign® comet_pdf®

CScript:

link::prefix

CLink.getPrefixIfEmpty()¶

Get the current prefix of the placeholder if it is empty.

Returns:

The prefix if empty

Return type:

str

Available:

InDesign® comet_pdf®

CScript:

link::prefix_if_empty

CLink.getPostfix()¶

Get the current postfix of the placeholder.

Returns:

The postfix

Return type:

str

Available:

InDesign® comet_pdf®

CScript:

link::postfix

CLink.getPostfixIfEmpty()¶

Get the current postfix of the placeholder if it is empty.

Returns:

The postfix if empty

Return type:

str

Available:

InDesign® comet_pdf®

CScript:

link::postfix_if_empty

Special methods¶

CLink.__repr__()¶

String representation.

Returns:

<CLink> Type: Type | Frame UID: Frame UID | PH ID: Placeholder ID | ID1: ID1 | ID2: ID2 | ID3: ID3 | StringID: ‘StringID’

For getType() == constants.kLinkTypeText :
Start: Start index | Length: Length
Examples¶
<CLink> Type: Frame | Frame UID: 1027 | PH ID: 100 | ID1: 5 | ID2: 1 | ID3: 0 | StringID: ''

<CLink> Type: Text | Frame UID: 240 | PH ID: 150 | ID1: 5 | ID2: 1 | ID3: 0 | StringID: '' | Start: 3 | Length: 5

Return type:

str

Table of Contents

  • comet.CLink
    • comet.CLink
    • Methods
      • CLink.getFrame()
      • CLink.getLayer()
      • CLink.getType()
      • CLink.getRecordID()
      • CLink.getPlaceHolderID()
      • CLink.getPosition()
      • CLink.getLength()
      • CLink.getContent()
      • CLink.getSyncState()
      • CLink.getFuncVars()
      • CLink.getPrefix()
      • CLink.getPrefixIfEmpty()
      • CLink.getPostfix()
      • CLink.getPostfixIfEmpty()
    • Special methods
      • CLink.__repr__()

Previous topic

comet.CLayer

Next topic

comet.CMagnet

This Page

  • Show Source

Quick search

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