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:
- Available:
InDesign® comet_pdf®
- CScript:
- CLink.getLayer()¶
Get the layer this link is on.
- Returns:
The layer
- Return type:
- Available:
InDesign® comet_pdf®
- CScript:
- CLink.getType()¶
Get the type of this link.
- Returns:
The link type. One of Link types
- Return type:
- Available:
InDesign® comet_pdf®
- CLink.getRecordID()¶
Gets the record ID of the link.
- CLink.getPlaceHolderID()¶
Get the ID of the placeholder of this link.
- Returns:
The placeholder ID
- Return type:
- Available:
InDesign® comet_pdf®
- CScript:
- CLink.getPosition()¶
Get the text start position for this link. For frame placeholders the result is always 0.
- 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:
- Available:
InDesign® comet_pdf®
- CScript:
- 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:
- 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:
- CScript:
- CLink.getSyncState()¶
Get the sync state of the link.
- Returns:
The link’s sync state. One of Sync states
- Return type:
- Available:
InDesign® comet_pdf®
- CScript:
- 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:
- Raises:
TypeError – When parameter types are invalid
ValueError – When parameter actionType has invalid Value
CometError – On internal error
- Available:
InDesign® comet_pdf®
- CScript:
- CLink.getPrefix()¶
Get the current prefix of the placeholder.
- Returns:
The prefix
- Return type:
- Available:
InDesign® comet_pdf®
- CScript:
- CLink.getPrefixIfEmpty()¶
Get the current prefix of the placeholder if it is empty.
- Returns:
The prefix if empty
- Return type:
- Available:
InDesign® comet_pdf®
- CScript:
- CLink.getPostfix()¶
Get the current postfix of the placeholder.
- Returns:
The postfix
- Return type:
- Available:
InDesign® comet_pdf®
- CScript:
- CLink.getPostfixIfEmpty()¶
Get the current postfix of the placeholder if it is empty.
- Returns:
The postfix if empty
- Return type:
- Available:
InDesign® comet_pdf®
- CScript:
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<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: