comet.CFrame

class comet.CFrame
Inherits:

comet.CPageItem

InDesign® comet_pdf® CFrame is a reference to a document page item (e.g. a frame)

Illustrator® CFrame is a reference to a document art object (e.g. a text frame)

Inherited methods

CFrame.getUID()

Get the UID of this item as an int.

Returns:

The UID of this item

Return type:

int

Raises:

CometError – On internal error

Available:

InDesign® comet_pdf®

CScript:

item::getint

CFrame.getType()

Determine the type of the item.

Returns:

The type of the item.

One of Pageitem types

Return type:

int

Raises:

CometError – On internal error

Available:

InDesign® comet_pdf® Illustrator®

CScript:
CFrame.getDocument()

Get the document this item belongs to.

Returns:

The document

Return type:

CDocument

Raises:

CometError – On internal error

Available:

InDesign® comet_pdf® Illustrator®

CFrame.getPage(queryNearest=False)

Get the page this item is on.

Parameters:

queryNearest (bool) – When the item is not on a page find the closest page?

Returns:

The page the item is on

Return type:

CPage

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:

page::get

CFrame.getLayer()

Get the layer this item is on.

Returns:

The item’s layer

Return type:

CLayer

Raises:

CometError – On internal error

Available:

InDesign® comet_pdf® Illustrator®

CScript:

frame::get_layer

CFrame.setLayer(layer, moveGroup=False, ignoreLayerLocks=False)

Move this item to another layer.

Parameters:
  • layer (str | list[str] | int | CLayer) –

    The new target layer.

    The parameter type can be:

    • str

      Name of a top level layer.

    • list [str]

      Nested layer path.

    • int

      Top level layer index counting from the bottom.

    • CLayer

      Layer. Must be in the same document as this item.

  • moveGroup (bool) –

    • True: In case of sub or inline frames, the topmost item is moved instead.

    • False: Do not move sub or inline frames. The function will raise CometError in this case.

  • ignoreLayerLocks (bool) –

    Allow moving from and to locked layers?

    • TrueIgnore all layer locks.

      Attention : This may change te current document selection

    • False : Do not move items from or to locked layers.

Return type:

None

Raises:
  • TypeError – When parameter types are invalid

  • ValueError – When parameter layer is empty str or invalid int or None

  • CometError – On internal error

Available:

InDesign® comet_pdf® Illustrator®

CScript:
CFrame.getParent()

Get the parent (e.g. containing frame) of this page item if one exists.

Returns:

The parent item or None if none exists.

Return type:

CPageItem | None

Raises:

CometError – On internal error

Available:

InDesign® comet_pdf® Illustrator®

CScript:

frame::parent

CFrame.getGroup()

Get the group this item belongs to, if any.

Returns:

The group if one exists, else None

Return type:

CGroup | None

Raises:

CometError – On internal error

Available:

InDesign® comet_pdf® Illustrator®

CScript:

frame::get_group

CFrame.getName(nameType=0, translate=False)

Get the name of this item as displayed in the layer panel.

Parameters:
  • nameType (int) –

    The kind of name to retrieve.

    • 0: User defined name. If empty return the default name.

    • 1: Default name

    • 2: User defined name. If not set the result string is empty

  • translate (bool) –

    Translate the default name?

    InDesign® The internal untranslated name of an empty graphic frame is #Graphicframe. This is translated to Graphic frame by an English version of InDesign®.

    Illustrator® Ignored

Returns:

The name of this frame

Return type:

str

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:

frame::get_name

CFrame.setName(name)

Set the name of this item.

Parameters:

name (str) –

The new name.

  • Empty str: Reset to default name.

Raises:

TypeError – When parameter types are invalid

Available:

InDesign® comet_pdf® Illustrator®

CScript:

frame::set_name

CFrame.getBBox(spreadRelative=False)

Get the bounding box of this item.

Parameters:

spreadRelative (bool) –

Get the coordinates relative to the page or to the spread the item is on?

Illustrator® Ignored

Returns:

The bounding box

Return type:

CRect

Raises:

TypeError – When parameter types are invalid

Available:

InDesign® comet_pdf® Illustrator®

CScript:

frame::bbox

CFrame.moveTo(x, y, page=-1, executeLayoutRules=False, refPoint=0, useBBox=True)

Move a frame to new coordinates. The frame may also be moved to another page. The new position is the position of the left upper corner of the frame’s bounding box.

Parameters:
  • x (float) – The new X position

  • y (float) – The new Y position

  • page

    Move frames to another page?

    The parameter type can be:

    When the parameter is -1, the page is unchanged.

  • executeLayoutRules (bool) –

    Execute layout rules “After geometry changes” while executing the command?

    • TrueYes, execute rules “after geometry” changes.

      This may cause problems and/or side effects like infinite recursion!

    • False : No, supress rules if any.

  • refPoint (int) –

    The reference point to move to the new coordinates.

    One of Reference Points.

    Default is constants.kRefPointTopLeft.

    InDesign® comet_pdf® Ignored. The left top point is always used.

  • useBBox (bool) –

    Whether to move the reference point of the bounding box or the actual item.

    • True: Move reference point of bounding box to the new coordinates.

    • False: Move the actual reference point of the page item to the new coordinates.

    InDesign® comet_pdf® Ignored. The parameter is always true.

Returns:

None

Raises:
Available:

InDesign® comet_pdf® Illustrator®

See also:

frame.moveTo()

CScript:

frame::moveto

CFrame.getSize(boundsKind=0)

Get the size of this page item.

Parameters:

boundsKind (int) –

Which bounds to get:

  • 0: Frame with stroke

  • 1: Frame without stroke

Returns:

tuple of (width, height)

Return type:

tuple[float, float]

Available:

InDesign® comet_pdf® Illustrator®

CScript:

frame::get_size

CFrame.setSize(width=-1.0, height=-1.0, boundsKind=0, refPoint=0, offsetX=0.0, offsetY=0.0, executeLayoutRules=False)

Change the size of this page item.

Page items must be greater than 0.0 Points and must not be smaller than the strokes at both sides.

So a page item with a stroke of 10 points must have a size of at least 20 points.

InDesign®

  • If strokes avoid page item resizing, the function tries to reduce the stroke at first.

  • Lines are treated differently by InDesign®: Slanted lines can become orthogonal lines. But orthogonal lines can only change their length. The attempt to turn orthogonal lines into slanted lines is rejected by InDesign® with the error kIllegalDimensionErr (11269)

  • Points are ignored by the function without errors.

Parameters:
  • width (float) –

    New frame width

    • -1.0: Leave unchanged

  • height (float) –

    New frame height

    • -1.0: Leave unchanged

  • boundsKind (int) –

    Which bounds to set:

    • 0: Frame with stroke

    • 1: Frame without stroke

    Illustrator® Ignored. The value is always 1

  • refPoint (int) –

    The reference point which is fixed during resize.

    One of Reference Points.

    Default is constants.kRefPointTopLeft.

  • offsetX (float) –

    Horizontal offset from the given reference point

    Illustrator® Ignored.

  • offsetY (float) –

    Vertical offset from the given reference point

    Illustrator® Ignored.

  • executeLayoutRules (bool) –

    Execute layout rules “After geometry changes” while executing the command?

    • TrueYes, execute rules “after geometry” changes.

      This may cause problems and/or side effects like infinite recursion!

    • False : No, suppress rules.

Return type:

None

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:

frame::resize

CFrame.getRefPoint(refPoint, pageRelative=True)

Get the coordinates of this pageitem’s reference point

Parameters:
  • refPoint (int) –

    The reference point to get the coordinates for.

    One of Reference Points.

  • pageRelative (bool) –

    InDesign® comet_pdf®

    • True: Get the coordinates as page-relative

    • False: Get the coordinates as spread relative

    Illustrator®

    • True: Get the coordinates as artboard-relative

    • False: Get the coordinates as global

Returns:

Coordinates (x, y)

Return type:

tuple[float, float]

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:

frame::refpoint

CFrame.getScale()

Get the item’s current scale factors.

Returns:

The scale factors (vertical, horizontal) where 1.0 = 100%.

Return type:

tuple[float, float]

Available:

InDesign® comet_pdf® Illustrator®

CScript:

frame::get_scale

CFrame.setScale(x, y, refPoint=0, executeLayoutRules=False)

Scale the item by the given factors.

Parameters:
  • x (float) – Width factor

  • y (float) – Height factor

  • refPoint

    The reference point to scale the frame around

    Depending on the parameter type, the behavior changes as follows:

    int

    Use a defined reference point.

    One of Reference Points.

    tuple (float, float)

    Horizontal and vertical offset from the top left point.

    comet_pdf® Ignored. The left top point is always used.

    Default is constants.kRefPointTopLeft

  • executeLayoutRules (bool) –

    Execute layout rules “After geometry changes” while executing the command?

    • TrueYes, execute rules “after geometry” changes.

      This may cause problems and/or side effects like infinite recursion!

    • False : No, suppress rules.

Return type:

None

Raises:
  • TypeError – When parameter types are invalid

  • ValueError

    • When parameter x or y are <= 0.0

    • When parameter refPoint is of type int and has invalid value

  • CometError – On internal error

Available:

InDesign® comet_pdf® Illustrator®

CScript:

frame::scale

CFrame.getRotation()

Get the item’s rotation

Returns:

The rotation in degrees

Return type:

float

Available:

InDesign® comet_pdf® Illustrator®

CScript:

frame::get_rotate

CFrame.setRotation(angle, refPoint=4, executeLayoutRules=False)

Rotate the item around it’s own reference point.

The rotation angle is absolute.

Parameters:
  • angle (float) – The angle to rotate the item in degrees counter clockwise

  • refPoint (int) –

    The reference point which is fixed during rotation.

    One of Reference Points.

    Default is constants.kRefPointCenter.

  • executeLayoutRules (bool) –

    Execute layout rules “After geometry changes” while executing the command?

    • TrueYes, execute rules “after geometry” changes.

      This may cause problems and/or side effects like infinite recursion!

    • False : No, suppress rules.

Return type:

None

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:

frame::rotate

CFrame.getSkew()

Get the current skew angle of the item.

Returns:

The current skew angle

Return type:

float

Available:

InDesign® comet_pdf®

CScript:

frame::get_skew

CFrame.setSkew(angle, refPoint=0, executeLayoutRules=False)

Skew an item horizontally. For a vertical skew, use the negative angle to skew followed by a rotation to the negative angle (use the same reference point for both transformations!).

Parameters:
  • angle (float) – The skew angle

  • refPoint (int | tuple[float, float]) –

    The reference point to scale the item around

    Depending on the parameter type, the behavior changes as follows:

    int

    Use a defined reference point. Value must be one of Reference Points

    tuple [float, float]

    Horizontal and vertical offset from the top left point.

    comet_pdf® Ignored. The left top point is always used.

    Default is constants.kRefPointTopLeft

  • executeLayoutRules (bool) –

    Execute layout rules “After geometry changes” while executing the command?

    • True:

      Yes, execute rules “after geometry” changes. This may cause problems and/or side effects like infinite recursion!

    • False:

      No, suppress rules.

Return type:

None

Raises:
Available:

InDesign® comet_pdf®

CScript:

frame::skew

CFrame.getLocked()

Returns whether the item is locked.

Returns:

Whether the item is locked

Return type:

bool

Raises:

CometError – On internal error

Available:

InDesign® comet_pdf® Illustrator®

CScript:

frame::is_locked

CFrame.setLocked(locked=True)

Set the lock state of the item.

Parameters:

locked (bool) – The new lock state

Return type:

None

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:
CFrame.getVisible()

Determine whether the item is visible or hidden.

Returns:

Whether the item is visible

Return type:

bool

Available:

InDesign® comet_pdf® Illustrator®

CScript:

frame::is_hidden

CFrame.setVisible(visible=True)

Set the visibility state of this item.

Parameters:

visible (bool) – Whether the item should be visible or not

Return type:

None

Raises:

TypeError – When parameter types are invalid

Available:

InDesign® comet_pdf® Illustrator®

CScript:
CFrame.getPrintable()

Get the printability of the item (printing and PDF exports).

Returns:

Whether the item is marked as printable

Return type:

bool

Raises:

CometError – On internal error

Available:

InDesign®

CScript:

frame::get_printable

CFrame.setPrintable(enable)

Set the printability of the item (printing and PDF exports).

Parameters:

enable (bool) – Enable printability?

Return type:

None

Raises:
Available:

InDesign®

CScript:

frame::set_printable

CFrame.getOverprint(what=0)

Get the overprint setting of the item.

Parameters:

what (int) –

Which setting to query

One of Overprint settings

Default is constants.kOverprintBasic

Returns:

Whether overprint is active for the queried setting

Return type:

bool

Raises:
Available:

InDesign®

CScript:

frame::get_overprint

CFrame.setOverprint(enable, what=0)

Set the overprint setting of the item.

Parameters:
Return type:

None

Raises:
Available:

InDesign®

CScript:

frame::set_overprint

CFrame.setStroke(options)

Set the stroke of this item.

Parameters:

options (dict[str, bool | int | float | str | CColor | CSwatch | tuple[int, int, int], tuple[float, float, float, float], tuple[float, int, int]]) –

The stroke options.

Keys must be str.

Value types depend on the provided keys.

The following options are available:

Stroke options

Key

Type

Description

’color’

The color to set.

The parameter type can be:

’width’

float

The stroke width in pt.

’tint’

float

The stroke tint in % in range(0.0-100.0).

’overprint’

bool

Whether to overprint the background.

’type’

int

The stroke type.

One of Stroke types

’gapColor’

str

A swatch name to use for the gap color.

’gapTint’

float

The stroke gap tint in % in range(0.0-100.0).

’gapOverprint’

bool

Whether to overprint the gap background.

’alignment’

int

Alignment of the stroke.

One of the following values:

  • 0: Centered

  • 1: Interior

  • 2: Outside

’miter’

float

Line miter in range(1.0-500.0).

Return type:

None

Raises:
  • TypeError

    • When parameter types are invalid.

    • When parameter options has non-str key.

    • When parameter options has value type which does not match the expected type.

  • ValueError

    • When parameter options[‘color’] has color values which are out of range.

    • When parameter options[‘width’] is < 0.0.

    • When parameter options[‘tint’] is out of range.

    • When parameter options[‘lineStyle’] is out of range.

    • When parameter options[‘gapTint’] is out of range.

    • When parameter options[‘alignment’] is out of range.

    • When parameter options[‘miter’] is out of range.

  • KeyError – When parameter options contains invalid key.

  • CometError – On internal error

Available:

InDesign® comet_pdf®

CScript:
CFrame.getObjectStyle(translate=False)

Get the full path to this item’s object style.

When the style if part of a hierarchy, the name is delimited by ‘:’

Parameters:

translate (bool) –

Translate default names?

  • True: Default names are returned in the host software locale.

  • False: In this case, the names of the default styles are always returned in English.

Returns:

Full path to the object style

Return type:

str

Raises:

CometError – On internal error

Available:

InDesign® comet_pdf®

CScript:

frame::get_objectstyle

CFrame.setObjectStyle(stylePath, removeOverrides=False)

Set this item’s object style.

Parameters:
  • stylePath (str) –

    Full object style path.

    When the style if part of a hierarchy, the name is delimited by ‘:’

    • ’’: Use default object style for this item type

  • removeOverrides (bool) – Remove local overrides?

Return type:

None

Raises:
Available:

InDesign® comet_pdf®

CScript:

frame::set_objectstyle

CFrame.getZOrder(intersecting=False)

Determine the Z order of this page item. If the page item is a group, this group is treated as one object, for all other groupings the page item are treated as individual objects.

Parameters:

intersecting (bool) –

  • False: Determine Z-order within the spread.

  • True: Use only the page items that overlap the specified page item to determine the Z-order.

The page item that is furthest forward has Z-order 1 - but it does not have to be the frontmost page item of the spread.

Likewise, of course, the page item with the largest Z-value does not need to be the bottom page item of the spread.

Illustrator® Ignored

Returns:

The 1-based Z order of the page item

Return type:

int

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:

frame::get_z_order

CFrame.moveForward()

Move the page item forward one step in the Z order.

Return type:

None

Raises:

CometError – On internal error

Available:

InDesign® comet_pdf® Illustrator®

CScript:

frame::bring_forward

CFrame.moveBackward()

Move the page item backward one step in the Z order.

Return type:

None

Raises:

CometError – On internal error

Available:

InDesign® comet_pdf® Illustrator®

CScript:

frame::send_backward

CFrame.moveToFront()

Move the page item to the most forward position undernearth its parent.

Return type:

None

Raises:

CometError – On internal error

Available:

InDesign® comet_pdf® Illustrator®

CScript:

frame::bring_to_front

CFrame.moveToBack()

Move the page item to the most backward position undernearth its parent.

Return type:

None

Raises:

CometError – On internal error

Available:

InDesign® comet_pdf® Illustrator®

CScript:

frame::send_to_back

CFrame.isInFront()

Determine whether the page item is the topmost item of its page.

Returns:

Whether the page item is at the top.

Return type:

bool

Raises:

CometError – On internal error

Available:

InDesign® comet_pdf® Illustrator®

CScript:

frame::is_in_front

CFrame.isInBack()

Determine whether the page item is the bottommost item of its page.

Returns:

Whether the page item is at the bottom.

Return type:

bool

Raises:

CometError – On internal error

Available:

InDesign® comet_pdf® Illustrator®

CScript:

frame::is_at_back

CFrame.getOpacity(type=0)

Get the opacity of this item.

Parameters:

type (int) –

Which opacity type to get.

  • 0 : Object

  • 1 : Stroke

  • 2 : Fill

  • 3 : Content

Returns:

The opacity in range[0.0, 100.0]

Return type:

float

Raises:
Available:

InDesign® comet_pdf®

CScript:

frame::get_opacity

CFrame.getFillColor()

Get the primary fill color of this item.

Returns:

The color and swatch if any is applied, else None.

Return type:

tuple[CColor, CSwatch | None]

Raises:

CometError – On internal error

Available:

InDesign® comet_pdf® Illustrator®

CScript:

frame::get_color

CFrame.setFillColor(color)

Set the primary fill color of this item.

Parameters:

color (CColor | CSwatch | str | tuple[int, int, int] | tuple[float, float, float, float]) –

The color data to apply.

The parameter type can be:

Return type:

None

Raises:
  • TypeError – When parameter types are invalid

  • ValueError – When parameter color is invalid or any provided values inside are invalid

  • CometError – On internal error

Available:

InDesign® comet_pdf® Illustrator®

CScript:

frame::color

CFrame.getScriptTag(key)

Get the value of a single script tag. Returns None when the key does not exist.

Parameters:

key (str) – The script tag key to get the value for

Returns:

The found value or None if the key does not exist.

InDesign® comet_pdf® Only values of type str are supported. Other data types get converted to string representations of their values.

Return type:

str | int | float | bool | None

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:

frame::get_script_tag

CFrame.getScriptTags()

Fetches all script tags of the item. Data types may vary depending on the tag type.

Returns:

A list of all script tags as key/values.

InDesign® comet_pdf® Only values of type str are supported. Other data types get converted to string representations of their values.

Return type:

list[tuple[str, str | int | float | bool]]

Raises:

CometError – On internal error

Available:

InDesign® comet_pdf® Illustrator®

CScript:
CFrame.setScriptTag(key, value)

Set the value of a script tag. The value is overwritten if it already exists.

Parameters:
  • key (str) – The script tag key to set

  • value (str | int | float | bool) –

    The value to set.

    InDesign® comet_pdf® Only values of type str are supported. Other data types get converted to string representations of their values.

Return type:

None

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:

frame::set_script_tag

CFrame.removeScriptTags(keys)

Remove script tags.

Parameters:

keys (list[str]) – The script tag keys to remove

Raises:
Return type:

None

Available:

InDesign® comet_pdf® Illustrator®

CFrame.getWrap()

Get the contour type and the contour spacing.

Returns:

A tuple of: (mode, left contour width, top contour height, right contour width, bottom contour width)

Where mode is one of Wrap types

Return type:

tuple[int, float, float, float, float]

Raises:

CometError – On internal error

Available:

InDesign® comet_pdf®

CScript:

frame::getwrap

CFrame.setWrap(mode=-1, left=None, top=None, right=None, bottom=None)

Set the contour type and the contour spacing.

Parameters:
  • mode (int) –

    The contour type.

    One of Wrap types

  • left

    The parameter type can be:

    • float: Left contour width. In case of using a contour, the value is set but unused.

    • None: Leave unchanged.

  • top

    The parameter type can be:

    • float: Upper contour height. In case of using a contour, the value is used as the distance around the shape.

    • None: Leave unchanged.

  • right

    The parameter type can be:

    • float: Right contour width. In case of using a contour, the value is set but unused.

    • None: Leave unchanged.

  • bottom

    The parameter type can be:

    • float: Bottom contour height. In case of using a contour, the value is set but unused.

    • None: Leave unchanged.

Return type:

None

Raises:
Available:

InDesign® comet_pdf®

CScript:

frame::wrap

CFrame.getWrapIgnore()

Determine whether this apply should apply the text outline guidance of other items.

Return bool:
  • True: Ignore contour guidance

  • False: Activate contour guidance

Raises:

CometError – On internal error

Available:

InDesign® comet_pdf®

CScript:

frame::getwrap_ignore

CFrame.setWrapIgnore(state=True)

Set whether or not this item should apply the text outline guidance of other items.

It does not influence whether the item itself sets an outline guide.

Parameters:

state (bool) –

  • True: Ignore contour guidance

  • False: Activate contour guidance

Return type:

None

Raises:

TypeError – When parameter types are invalid

Available:

InDesign® comet_pdf®

CScript:

frame::wrap_ignore

CFrame.overrideMasteritem(page)

Localize a given master page item for a document page.

Single-page spreads on double-page spreads and double-page spreads on single-page spreads are supported.

But in order to avoid horizontal shifts of the overridden items, spreads with more than two pages must use master pages with at least the same number of pages. Otherwise you must correct the horizontal shift in your scripts.

Parameters:

page (CPage | int) –

The target page which has the master page of the master item applied.

The parameter can type can be:

Returns:

The newly overridden and localized page item.

Return type:

CPageItem

Raises:

TypeError – When parameter types are invalid

Available:

InDesign® comet_pdf®

CScript:

frame::override_masteritem

CFrame.isMasteritemOverriden(page)

Is this master page item localized on a given page?

Please note that, unlike isOverridenMasteritem(), this method requires a page specification. Overrides are always done on a per-page basis.

Parameters:

page (CPage | int) –

The target page to query for an overridden master item.

The parameter can type can be:

Returns:

The overridden item or None when an overridden item does not exist.

Return type:

CPageItem | None

Raises:

TypeError – When parameter types are invalid

Available:

InDesign® comet_pdf®

CScript:

frame::is_masteritem_overriden

CFrame.isOverridenMasteritem()

Is this item an overridden master page item?

In contrast to isMasteritemOverriden(), the function does not require a page specification, as the page number can be determined implicitly from the given item reference.

Returns:

The master page item this item has been overridden from or None when no master item exists.

Return type:

CPageItem | None

Available:

InDesign® comet_pdf®

CScript:

frame::is_overriden_masteritem

CFrame.removeMasteritemOverride()

Remove all local overrides of this page item.

The function checks whether the page item is an overridden master page item at all and, if necessary, restores the original state of the master page item.

The item is then no longer localized.

If this page item is a sub-element of a group, the entire group is automatically processed.

Return type:

None

Raises:

CometError – On internal error

Available:

InDesign® comet_pdf®

CScript:

frame::remove_masteritem_override

CFrame.getAlternativeText()

Determine the settings for the alternative text of this item.

This setting can be made manually in InDesign® using the dialog Object -> Object export options… dialog in the Alternative text category.

Return A tuple of the following values:
  • Determined source of the alternative text.

  • User-defined alternative text. It is irrelevant whether the item actually uses this text (type 0) or not.

  • Namespace prefix in the XMP header. The value is defined automatically for XMP-based texts and is only of technical interest.

  • Input path in the XMP header. The value is defined automatically for XMP-based texts and is only of technical interest.

Return type:

tuple[int, str, str, str]

Raises:

CometError – On internal error

Available:

InDesign®

CScript:

frame::get_alt

CFrame.setAlternativeText(source, text='')

Define an alternative text as a frame or image description.

This setting can be made manually in InDesign® using the dialog Object -> Object export options… dialog in the Alternative text category.

Parameters:
  • source (int) –

    Source for the alternative text text.

    • 0: User-defined. The text is specified in the text parameter.


    The texts for the following information are determined from the IPTC core of the XMP structure of the image. You can define this information e.g. using the Adobe Bridge metadata panel.

    • 1: From XMP:Title

    • 2: From XMP:Description

    • 3: From XMP:Caption

    • 6: From XMP:Alternative text (accessibility)

    • 7: From XMP:Extended description (accessibility)


    These values are set but not further supported by priint:comet.

    • 4: From other XMP

    • 5: From structure

  • text (str) – User-defined description text. The specification is only used for source 0 (user-defined).

Return type:

None

Raises:

CometError – On internal error

Available:

InDesign®

CScript:

frame::set_alt

CFrame.getPDFAccessibility()

Determine the settings for accessible description text of this item.

This setting can be made manually in InDesign® using the dialog Object -> Object export options… in the PDF with tags category.

Returns:

A tuple of the following values:

  • Type of source of the accessible description text

  • Determined source of the accessible description text

  • User-defined accessible description text. It is irrelevant whether the item actually uses this text (type 0) or not.

  • Variable for the namespace prefix in the XMP header. The value is defined automatically for XMP-based texts and is only of technical interest.

  • Property path in the XMP header. The value is defined automatically for XMP-based texts and is only of technical interest.

Return type:

tuple[int, int, str, str, str]

Raises:

CometError – On internal error

Available:

InDesign®

CScript:

frame::get_pdf_accessibility

CFrame.setPDFAccessibility(type, source, text='')

Define a text for the accessible description of the content of a frame.

This setting can be made manually in InDesign® using the dialog Object -> Object export options… dialog in the PDF with tags category.

Parameters:
  • type (int) –

    Apply tag:

    • 0: From structure

    • 1: Extra-textual element

    • 2: Based on object

  • source (int) –

    Source for actual text

    • 0: User-defined. The text is specified in the text parameter.


    The texts for the following information are determined from the IPTC core of the XMP structure of the image. You can define this information e.g. using the Adobe Bridge metadata panel.

    • 1: From XMP:Title

    • 2: From XMP:Description

    • 3: From XMP:Caption

    • 6: From XMP:Alternative text (accessibility)

    • 7: From XMP:Extended description (accessibility)


    These values are set but not further supported by priint:comet.

    • 4: From other XMP

    • 5: From structure

  • text (str) – User-defined description text. The specification is only used for source 0 (user-defined).

Return type:

None

Raises:
  • TypeError – When parameter types are invalid

  • ValueError

    • When parameter type is out of range

    • When parameter source is out of range

  • CometError – On internal error

Available:

InDesign®

CScript:

frame::set_pdf_accessibility

CFrame.remove()

Deletes this item and all it’s children from it’s document.

All subsequent calls to this item’s or the item’s children functions will fail.

Return type:

None

Raises:

CometError – On internal error

Available:

InDesign® comet_pdf® Illustrator®

CScript:

frame::remove

Methods

CFrame.isInline()

Is this frame an inline frame?

Returns:

Whether this frame is an inline frame.

Return type:

bool

Raises:

CometError – On internal error

Available:

InDesign® comet_pdf® Illustrator®

CScript:

frame::is_inline

CFrame.isNote()

Is this frame a comet note?

Returns:

Whether this frame is a comet note.

Return type:

bool

Raises:

CometError – On internal error

Available:

InDesign® comet_pdf® Illustrator®

CScript:

frame::is_note

CFrame.getColumnCount()

Get the number of text columns of the frame

Returns:

The column count

Return type:

int

Raises:
Available:

InDesign® comet_pdf®

CScript:

frame::count_columns

CFrame.setColumnCount(count)

Set the column count of the frame

Parameters:

count (int) – The new count

Raises:
  • TypeError

    • When parameter types are invalid

    • When this frame is not a text frame

  • ValueError – When parameter count is < 1

  • CometError – On internal error

Return type:

None

Available:

InDesign® comet_pdf®

CScript:

frame::create_columns

CFrame.getColumnGutter()

Get the gutter of text columns of the frame

Returns:

The column gutter

Return type:

float

Raises:
Available:

InDesign® comet_pdf®

CScript:

frame::count_columns

CFrame.setColumnGutter(gutter)

Set the column gutter of the frame

Parameters:

gutter (float) –

The new gutter value.

  • < 0.0: Reset to default value

Return type:

None

Raises:
  • TypeError

    • When parameter types are invalid

    • When this frame is not a text frame

  • CometError – On internal error

Available:

InDesign® comet_pdf®

CScript:

frame::create_columns

CFrame.hasOverset(fullChain=True)

Are text parts of the text model or frame non-visible? If the text has this so-called overset, a small red plus is shown at the selected frame. The function can only ascertain the overset of textframes or texts.

Parameters:

fullChain (bool) –

Check the complete text frame chain?

  • True : Check complete chain

  • False : Check only this frame

Returns:

Whether the frame has overset

Return type:

bool

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:

frame::overset

CFrame.getTextModel()

Fetch the text model interface of this frame if it is a text frame.

Returns:

The frame’s text model

Return type:

CTextModel

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CFrame.getText(position=0, length=-1, format=0)

Get text content of a Text frame.

The export can be carried out as pure text (constants.kExportPlain) or as text with formatting.

InDesign®

Formattings are written as InDesign® TaggedText. The format of the TaggedText is independent from the settings of the export dialog and is always done with the following settings :

Coding ASCII, Unicode characters are written in the form <0x2202> Platform Windows,rn (13 10) is used as line delimiter of the (internal) formatting Style unabbreviated, i.e. ParaStyle instead of pstyle, …

If the text contains InDesign® variables, the internal code used in the document (and not the current value) is exported on pure text formats like constants.kExportPlain. Use the ~Plus~-Formats to replace InDesign® variables by their current values.

Parameters:
Returns:

The frame’s text

Return type:

str

Raises:
  • TypeError

    • When parameter types are invalid

    • When this frame is not a text frame

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

  • CometError – On internal error

Available:

InDesign® comet_pdf® Illustrator®

CScript:

frame::gettext

See also

setText()

CFrame.setText(text, start=0, length=-1, autoLoad=True, flags=0)

Replace text in the frame. Inserting formatted text like TaggedText or HTML is also possible.

Parameters:
  • text (str) – The text to insert

  • start (int) – Insert position in the text

  • length (int) –

    Number of characters to replace.

    Default is constants.kEnd == until the end

  • autoLoad (bool) –

    When inserting TaggedText, should placeholders be loaded?

    Illustrator® Ignored

  • flags (int) –

    Instructions for preparing TaggedText.

    • 0 : Off

    • 2 : Fix parastyles of all cells

    • 4 : Fix parastyles of complete text

    • 8 : Check tables

    • 16 : Replace <in> tags by <w2inline> tags

    • 32 : Repair hyperlinks

    Please note:
    For normal text, the parameter has no meaning.

    As of v4.1.6 R25777 the w2inline replacement always is done automatically. Since w2inline is a character attribute and can only be evaluated if a paragraph style is defined, the paragraphs will also be corrected in all non-empty table cells. Changes to your TaggedText are not required for this.

    InDesign® If the option Plug-Ins -> Comet -> Read PlaceHolders from TaggedText is disabled, the flags 2, 4 and 16 do not have any meaning and are ignored.

    comet_pdf® Flags 2 and 4 have no meaning, missing or empty paragraph styles are always calculated and used here.

    Illustrator® Ignored

Raises:
  • TypeError

    • When parameter types are invalid

    • When this frame is not a text frame

  • CometError – On internal error

Returns:

None

Available:

InDesign® comet_pdf® Illustrator®

CScript:

frame::replace

See also

getText()

CFrame.replace(content, position=0, length=-1, autoLoad=True, flags=0)

Replace text in a frame.

InDesign® comet_pdf® The text may be TaggedText.

InDesign® comet_pdf® Illustrator® The text may be prefixed HTML text.

Parameters:
  • content (str) – The text to insert.

  • position (int) – The position to insert the text.

  • length (int) –

    How many characters should be overwritten at max?

    Default is constants.kEnd == overwrite until the end.

  • autoLoad (bool) –

    Should text placeholders in TaggedText be loaded?

    Illustrator® Ignored

  • flags (int) –

    Instructions for preparing TaggedText. For normal text, the parameter has no effect.

    • 0 : Off

    • 1 : Fix parastyles of non-empty cells

    • 2 : Fix parastyles of all cells

    • 4 : Fix parastyles of complete text

    • 8 : Check tables

    • 16 : Replace <in> tags by <w2inline> tags

    Illustrator® Ignored

    comet_pdf® Values 1, 2 and 4 are ignored. Missing or empty paragraph styles are always calculated and used here.

Returns:

None

Raises:
  • TypeError – When parameter types are invalid

  • ValueError – When parameters length or flags are out of range or invalid

  • CometError – On internal error

Available:

InDesign® comet_pdf® Illustrator®

CScript:

frame::replace

CFrame.fit(refPoint=0, constantWidth=False)

Fit a frame to its content

Parameters:
  • refPoint (int) –

    The reference point which is fixed during resizing.

    One of Reference Points.

  • constantWidth (bool) – When the text content is on a single line, should we keep the width?

Returns:

Result sizes as (new width, new height)

Return type:

tuple[float, float]

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:

frame::fit_better

CFrame.fitImage(method, data=5, size=0.0, maxScale=1.0)

Fit an image to its frame.

Parameters:
  • method (int) –

    Fitting method. One of:

    • 0: Fill frame proportionally: Scale image proportionally to completely fill the frame

    • 1: Fit content proportionally: Scale image to become completely visible

    • 2: Fit content to frame:Scale image in both directions to completely fill the frame

    • 3: Fit frame to content: Fit the frame to match the image.

    • 4: Center content in frame

    • 5: Comet position

  • data (int) –

    Additional information about the placement of the image.

    Methods 0, 1, 2 and 4:

    -1: Use InDesign® built-in method only

    Otherwise: Use priint:comet method

    Method 5:

    Image position. If the parameter is omitted, then - if the image has already been placed by the Comet - the last Comet placement for this image is restored.

  • size (float) – Image placement size of bounding box for image.

  • maxScale (float) – Maximum image scaling factor

Returns:

None

Raises:
  • TypeError – When parameter types are invalid

  • ValueError

    • When parameter method has invalid value.

    • When parameter data has invalid value.

    • When parameter size has invalid value.

    • When parameter maxScale has invalid value.

  • CometError – On internal error

Available:

InDesign® comet_pdf®

CScript:

frame::fit_image

CFrame.getChainFrames()

Get all frames in the chain of this frame.

The result is ordered in the order the frames are linked.

Returns:

A list of all chained frames including this one.

Return type:

list[CFrame]

Raises:
Available:

InDesign® comet_pdf®

CScript:

itemlist::chained

CFrame.getImage()

Get the full path to the image in this frame

Returns:

The image path

Return type:

str

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:

frame::image_getpath

CFrame.setImage(path, alignment=0, boundingBox=0.0, options={})

InDesign® comet_pdf® Insert an image into this frame

Illustrator® Replace the image

Parameters:
  • path (str) – The full path to the image file

  • alignment (int) –

    InDesign® comet_pdf® The alignment of the image in the frame.

    Illustrator® Align this reference point with the same reference point of the old image.

    One of Image placement.

    For more information see here.

  • boundingBox (float) –

    The new size of the image.

    • 0.0 : Fit image (proportionally) into the frame. If the image is smaller than the frame it is left unchanged.

    • > 0.0 : Fit image proportionally into a square frame of this size. If the image is smaller, it is not changed.

    • < 0.0 : Fit image proportionally into a square frame of this size. If the image is smaller, it is enlarged accordingly.

    Illustrator® Ignored

  • options (dict[str, str | int]) –

    Additional import options which depend on the input file type.

    Keys must be str. Value types depend on the provided keys.

    The following options are available:

    PDF

    ’kPageIndex’

    • Value type: int

    • Default: 0

    The page index to place from the PDF file.

    • -1: Use last page.

    • Greater than page count - 1: Use first page.

    • Else: Place the page with this index.

    ’kPageNumber’

    • Value type: int

    • Default: 1

    The page number to place from the PDF file. This behaves the same as ‘kPageIndex’ but uses 1-based numbers.

    This option is mutually exclusive with ‘kPageIndex’.

    ’kCropBox’

    • Value type: int or str

    • Default: ‘kDefault’

    The cropping behavior to apply.

    The following values are available:

    • ’kDefault’, -1 or 1: Use the application default.

    • ’kContent’, or 0: Crop to content.

    • ’kArt’, or 2: Crop to art.

    • ’kCrop’, or 3: Crop to page.

    • ’kTrim’, or 4: Crop to trim.

    • ’kBleed’, or 5: Crop to bleed.

    • ’kMedia’, or 6: Crop to media.

    • ’kContentAllLayers’, or 7: Crop to content (all layers).

      Illustrator® Not supported.

    ’kLayers’

    • Value type: list [str]

    • Default: []

    List of layer names.

    All specified layers of the PDF file will be made visible, all others invisible.

    If the list is empty, the layer visibility settings of the PDF file will be used.

    Attention: It is not sufficient to set the layer visibility in the PDF with the layer eyes only, you have to use the layer options for that!

    Illustrator® Not supported.

    ’kTransparentBackground’

    Should the background be transparent?

    Pixel Images

    ’kPathIndex’

    • Value type: int

    • Default: -1

    0-based index of clipping path

    • -3: If there is already a clip path, this path is reset.

    • -2: Ignore.

    • -1: Use the setting of kPathName.

    • >= 0: 0-based index of clipping path. Ignored by comet_pdf!

    ’kPathName’

    • Value type: str

    Name of clipping path. The option is ignored by InDesign® if the path is defined by kPathIndex already.

    ’kClipToFrame’

    Use the the clipping path as the frames path?

    • -3: If there is already a clip path, this path is reset.

    • -2: Ignore.

    The following values are available:

    ’kPathFlags’

    • Value type: int

    • Default: 0

    How to clip the image? Positive values can be added.

    • -1: Ignore value.

    • 0: Reset option.

    • 1: Invert the resulting path by combining with a path equal to the bounds of the image.

    • 4: For edge detection, do we remove the holes or leave them in.

    • 8: Crop the frame to the image.

      comet_pdf® Ignored.

    ’kClipTolerance’

    • Value type: double

    • Default: 0.0

    A tolerance value in the range of 0.0 to 10.0 specifying how close to the original path we must be if we smooth the path. 0.0 indicates a perfect match. Smoothing may simplify the path, reducing the number of points.

    comet_pdf® Ignored.

    ’kClipMinPathSize’

    • Value type: double

    • Default: 0.0

    A tolerance value in the range of 0.0 to 10.0 specifying how close to the original path we must be if we smooth the path. 0.0 indicates a perfect match. Smoothing may simplify the path, reducing the number of points.

    comet_pdf® Ignored.

    ’kClipInset’

    • Value type: double

    • Default: 0.0

    How far to inset the path. Given in points.

    comet_pdf® Ignored.

    ’kAlphaIndex’

    • Value type: int

    • Default: -4

    0-based index of channel

    • -6: Reset option value to default (-4).

    • -5: Ignore (leave value of option untouched).

    • -4: Use the setting of kPathName.

    • -3: Default Clip index (0 InDesign, -2 comet_pdf).

    • -2: Ignore any Alpha channel.

    • -1: Use kAlphaName.

    • >= 0: 0-based index of Alpha channel. Ignored by comet_pdf!

    ’kAlphaName’

    • Value type: str

    Name of Alpha channel. The value ignored by InDesign® if the channel is defined by its index already.

    ’kAlphaTreshold’

    • Value type: int

    • Default: 255

    Treshold for alpha channel.

    • 0-255: The alpha channel is applied to the image after the image import. The result is the same like using menu Object -> Clipping path -> Options and indeed it is a very bad result. Ignored by comet_pdf.

    • >255: Recommended! Apply the alpha channel directly while importing the image.

    Web Images (URLs)

    ’kURLSuppressCheckExisting’

    This option is mutually exclusive with ‘kUpdateFlags’.

    • True: If the local image file already exists, it is used without further checkings.

    • False: Also check whether an existing image file is still up to date.

    ’kUpdateFlags’

    • Value type: int

    • Default: 0

    Flags used when loading URL images. Available from v5.0 onwards.

    This option is mutually exclusive with ‘kURLSuppressCheckExisting’.

    16: If the local image file already exists, it is used without further checking.

Return type:

None

Raises:
  • TypeError – When parameter types are invalid

  • ValueError

    • When parameter path is empty

    • When parameter alignment has invalid value

  • CometError – On internal error

Available:

InDesign® comet_pdf® Illustrator®

CScript:
CFrame.setBarcode(code, type, width=144, height=92, offsetX=10, offsetY=10, options={'options': 'includetext'})

Create and insert a barcode.

Since this function depends on third party implementations, it is considered ‘nice to have’ and not part of support coverage.

A barcode in the required format is generated from the specified text and embedded in the document frame as a postscript image without any further linking.

No additional image files are created.

InDesign®

Directly embedded postscript images are changed during IDML export/import by InDesign®:

  • Embedded postscript images are automatically converted to pixel images during import. The converted image is thenembedded in a new frame. This frame is then created as a subframe of the original frame.

  • The pixel images may have a different size than the original postscript images.

  • The pixel images (naturally) have a fixed resolution. (But we do not know this).

If your documents are to remain IDML-stable, the images must be created either as normal file links or as embedded images of files. The function supports both methods.

See the optional parameters filetype and filepath.

Parameters:
  • code (str) –

    Text to be encoded.

    Braces and backslashes in the text are automatically encoded.

  • type (str) –

    Barcode type. The following types are supported:

    Barcode types

    Name

    Value

    Example code

    Example output

    EAN-5

    ’ean5’

    90200

    _images/ean5.png

    EAN-8

    ’ean’

    01335583

    _images/ean8.png

    EAN-8 Composite

    ’ean8composit’

    12345670|(21)A12345678

    _images/ean8comp.png

    EAN-13

    ’ean1’

    9771473968012

    _images/ean13.png

    EAN-13 Composite

    ’ean13composit’

    331234567890|(99)1234-abcd

    _images/ean13comp.png

    EAN-2

    ’ean’

    05

    _images/ean2.png

    QR Code.

    ’qrcode’

    Irgendwas

    _images/qrcode.png

    Data Matrix

    ’datamatrix’

    This is Data Matrix!

    _images/datamatrix.png

    MaxiCode

    ’maxicode’

    [)>^03001^02996152382802¬ ^029840^029001^0291Z00004951¬ ^029UPSN^02906X610^029159¬ ^0291234567^0291/1^029^029Y¬ ^029634 ALPHA DR¬ ^029PITTSBURGH^029PA^029^004

    _images/maxicode.png

    Aztec Code

    ’azteccode’

    This is Aztec Code

    _images/aztek.png

    UPC-A

    ’upca’

    78858101497

    _images/upca.png

    UPC-A Composite

    ’upcacomposite’

    01600033610|(99)1234-abcd

    _images/upcacomp.png

    UPC-E

    ’upce’

    0123456

    _images/upce.png

    UPC-E Composite

    ’upcecomposite’

    0121230|(15)021231

    ISBN

    ’isbn’

    978-1-56592-4796 54495

    _images/isbn.png

    ISMN

    ’ismn’

    979-0-2600-0043

    _images/ismn.png

    ISSN

    ’issn’

    0317-8471 00 05

    _images/issn.png

    Code One

    ’codeone’

    Das ist eine Nachricht!

    _images/codeone.png

    Code 16K

    ’code16k’

    Abcd-1234567890-wxyZ

    _images/code16k.png

    Code 39

    ’code39’

    THIS IS CODE 39

    Code 39 Extended

    ’code39ext’

    Code39 Ext!

    Code 128

    ’code128’

    Count01234567^FNC2!

    Code 49

    ’code49’

    MULTIPLE ROWS IN CODE 49

    _images/code49.png

    GS1-14

    ’ean14’

    (01)04601234567893

    GS1 Composite 2D Component

    ’gs1-cc’

    (01)95012345678903(3103)000123

    GS1 Data Matrix

    ’gs1datamatrix’

    (01)03453120000011(17)120508(10)¬ ABCD1234(410)9501101020917

    _images/gs1datamatrix.png

    GS1-128

    gs1-128

    (01)95012345678903(3103)000123

    GS1-128 Composite

    ’gs1-128composite’

    (00)030123456789012340|(02)130¬ 12345678909(37)24¬ (10)1234567ABCDEFG

    _images/gs1-128composite.png

    GS1 DataBar Omnidirectional

    ’databaromni’

    (01)24012345678905

    GS1 DataBar Omnidirectional Composite

    ’databaromnicomposite’

    (01)03612345678904|(11)990102

    GS1 DataBar Stacked

    ’databarstacked’

    (01)24012345678905

    GS1 DataBar Stacked Composite

    ’databarstackedcomposite’

    (01)03412345678900|(17)010200

    GS1 DataBar Stacked Omnidirectional

    ’databarstackedomni’

    (01)24012345678905

    GS1 DataBar Stacked Omnidirectional Composite

    ’databarstackedomnicomposite’

    (01)03612345678904|(11)990102

    GS1 DataBar Truncated

    ’databartruncated’

    (01)24012345678905

    GS1 DataBar Truncated Composite

    ’databartruncatedcomposite’

    (01)03612345678904|(11)990102

    GS1 DataBar Limited

    ’databarlimited’

    (01)15012345678907

    GS1 DataBar Limited Composite

    ’databarlimitedcomposite’

    (01)03512345678907|(21)abcdefghijklmnopqrstuv

    GS1 DataBar Expanded

    ’databarexpanded’

    (01)95012345678903(3103)000123

    GS1 DataBar Expanded Composite

    ’databarexpandedcomposite’

    (01)93712345678904(3103)¬ 001234|(91)1A2B3C4D5E

    GS1 DataBar Expanded Stacked

    ’databarexpandedstacked’

    (01)95012345678903(3103)000123

    GS1 DataBar Expanded Stacked Composite

    ’databarexpandedstackedcomposite’

    (01)00012345678905(10)¬ ABCDEF|(21)12345678

    SSCC-18

    ’sscc18’

    (00)006141411234567890

    Italian PharmaCode

    ’code32’

    01234567

    Pharmazentralnummer

    ’pzn’

    123456

    Interleaved 2 of 5 (ITF)

    ’interleaved2of5’

    2401234567

    ITF-14

    ’itf14’

    04601234567893

    _images/itf14.png

    Pharmaceutical Binary Code

    ’pharmacode’

    117480

    _images/pharmacode.png

    Two-track Pharmacode

    ’pharmacode2’

    117480

    Code 25

    ’code2of5’

    01234567

    Code 11

    ’code11’

    0123456789

    BC412

    ’bc412’

    BC412

    Rationalized Codabar

    ’rationalizedCodabar’

    A0123456789B

    Deutsche Post Identcode

    ’identcode’

    563102430313

    _images/identcode.png

    Deutsche Post Leitcode

    ’leitcode’

    21348075016401

    United States Postal Service Intelligent Mail

    ’onecode’

    0123456709498765432101234567891

    _images/onecode.png

    United States Postal Service POSTNET

    ’postnet’

    01234

    _images/postnet.png

    United States Postal Service PLANET

    ’planet’

    01234567890

    Royal Mail 4 State Customer Code (RM4SCC)

    ’royalmail’

    LE28HS9Z

    AusPost 4 State Customer Code

    ’auspost’

    5956439111ABA 9

    Royal Dutch TPG Post KIX 4-State Barcode

    ’kix’

    1231FZ13XHS

    Japan Post 4 State Customer Code

    ’japanpost’

    6540123789-A-K-Z

    MSI Modified Plessey

    ’msi’

    0123456789

    Plessey UK

    ’plessey’

    01234ABCD

    Telepen

    ’telepen’

    123456

    PosiCode

    ’posicode’

    ABC123

    Codablock F

    ’codablockf’

    CODABLOCK F 34567890¬ 123456789010040digit

    Channel Code

    ’channelcode’

    3493

    Flattermarken

    ’flattermarken’

    12345

    Raw bar space succession for custom symbologies

    ’raw’

    331132131313411122¬ 131311333213114131131221323

    _images/raw.png

    Raw DAFT succession for custom 4 state symbologies

    ’daft’

    FATDAFTDAD

    Miscellaneous symbols

    ’symbol’

    fima

    PDF417

    ’pdf417’

    This is PDF417

    MicroPDF417

    ’micropdf417’

    MicroPDF417

    HIBC Code 39

    ’hibccode39’

    A123BJC5D6E71

    HIBC Code 128

    ’hibccode128’

    A123BJC5D6E71

    HIBC Data Matrix

    ’hibcdatamatrix’

    A123BJC5D6E71

    HIBC PDF417

    ’hibcpdf417’

    A123BJC5D6E71

    HIBC MicroPDF417

    ’hibcmicropdf417’

    A123BJC5D6E71

    HIBC QR Code

    ’hibcqrcode’

    A123BJC5D6E71

    _images/hibcqrcode.png

    HIBC Codablock F

    ’hibccodablockf’

    A123BJC5D6E71

    _images/hibccodablockf.png

  • width (int) –

    Size of the generated image in dots.

    The size does not affect the size of the barcode. It influences the “page size” on which the barcode is drawn.

    The barcode is always drawn at the bottom left (typical for postscript).

    The larger the values you use for width and height, the larger the white space at the top and right.

    You may have to try a little until you have found the optimum size for your barcodes.

  • height (int) – Height in dots. See parameter width.

  • offsetX (int) –

    The distance of the barcode from the bottom left corner of the image.

    The information always describes the position of the actual code.

    Additional text information can appear below and to the left of this position.

    Here, too, you may have to experiment a little until you have found the correct information

  • offsetY (int) – The distance of the barcode from the bottom left corner of the image. See parameter offsetX.

  • options (dict[str, bool | float | str]) –

    Additional options.

    Here you will find a description of all supported values. Further code-specific values can be found in the descriptions of the respective codes.

    The default value includes the option ‘includetext’ with a value of True. If no texts are to be added to the code, you can specify the key ‘suppresstext’ with a value of True in addition to the information described above.

    The following options are common for all barcode types:

    Common options

    ’options’

    Type: str

    ’filetype’

    Type: str

    IDML-safe embedding of the generated barcode. The following values are possible:

    • ’ps’: The reference to the image file is embedded in the frame, not its content. The PS file is then no longer required and is deleted. However, the “Embedded” entry for the PS file remains in the Links palette.

    • ’jpg’ / ‘tif’ / ‘gif’: The content of the image file is embedded in the frame. There is no further entry in the Links palette, but the images naturally only have a fixed resolution. The resolution can be specified in the resolution parameter.

    comet_pdf® Illustrator® Ignored.

    ’filepath’

    Type: str

    Complete path of an output file. The generated barcode is saved as a file and linked in the document.

    The file resolution (except of course for Postscript) is determined by the resolution parameter.

    The file format is determined from the file extension. The following file extensions are permitted:

    ’ps’, ‘jpg’, ‘tif’, ‘gif’

    comet_pdf® Illustrator® Ignored.

    ’resolution’

    Type: float

    Resolution of the generated GIF/TIF/JPG image.

    If the value is missing, images are generated with a resolution of 600 DPI.

    The value is ignored if Postscript is embedded or linked.

    comet_pdf® Illustrator® Ignored.

Return type:

None

Raises:
  • TypeError

    • When parameter types are invalid

    • When parameter options contains invalid value types

  • ValueError

    • When parameter type is empty or has invalid value

    • When parameters width or height are <= 0

  • CometError – On internal error

Available:

InDesign® comet_pdf® Illustrator®

CScript:

image::barcode

CFrame.getImageSize(boundsKind=0)

Ascertain the absolute size of the image in this frame.

Parameters:

boundsKind (int) –

Which type of size to fetch.

  • 0: Bounding box

  • 1: Image frame size

Returns:

Size as (width, height)

Return type:

tuple[float, float]

Raises:
  • TypeError – When this frame is not an image frame

  • ValueError – When parameter boundsKind has invalid value

  • CometError – On internal error

Available:

InDesign® comet_pdf®

CScript:

frame::image_getsize

CFrame.setImageSize(width, height, refPoint=0)

Set the absolute size of the image in this frame.

Parameters:
Return type:

None

Raises:
Available:

InDesign® comet_pdf®

CScript:

frame::image_size

CFrame.getImagePosition(boundsKind=0)

Ascertain the position of the image inside this frame. The result values are relative to the top left corner of this frame.

Parameters:

boundsKind (int) –

Fetch position relative to these bounds.

  • 0: Outer stroke path

  • 1: Path bounds (“blue” frame)

Returns:

Position as (x, y)

Return type:

tuple[float, float]

Raises:
  • TypeError

    • When parameter types are invalid

    • When this frame is not an image frame

  • ValueError – When parameter boundsKind has invalid value

  • CometError – On internal error.

Available:

InDesign® comet_pdf®

CScript:

frame::image_getpos

CFrame.setImagePosition(x, y)

Set the position of the image in this frame.

Parameters:
  • x (float) – New image x position

  • y (float) – New image y position

Return type:

None

Raises:
  • TypeError

    • When parameter types are invalid

    • When this frame is not an image frame

  • CometError – On internal error.

Available:

InDesign® comet_pdf®

CScript:

frame::image_pos

CFrame.getImageScale()

Ascertain the relative size of the image in this frame to its original size.

Return values are factors where 1.0 = 100%

Returns:

Size as (scaling factor x, scaling factor y)

Return type:

tuple[float, float]

Raises:
Available:

InDesign® comet_pdf®

CScript:

frame::image_getscale

CFrame.setImageScale(width, height, refPoint=0, frameRelativeRefPoint=False)

Set the size of the image in this frame relative to its original size.

Parameters:
  • width (float) – New image width factor

  • height (float) – New image height factor

  • refPoint (int) –

    The reference point which is fixed during resize.

    One of Reference Points.

    Default is constants.kRefPointTopLeft

  • frameRelativeRefPoint (bool) –

    Should the graphics frame be used as the basis for the reference point instead of the image itself?

    • True: Use the graphics frame as the basis for calculating the reference points.

    • False: No, use image as basis for calculating the reference point.

Return type:

None

Raises:
Available:

InDesign® comet_pdf®

CScript:

frame::image_scale

CFrame.getImageRotation()

Ascertain the rotation of the image in this frame.

Returns:

The rotation angle in degrees

Return type:

float

Raises:
Available:

InDesign® comet_pdf®

CScript:

frame::image_getrotation

CFrame.setImageRotation(angle, x, y)

Rotate the image in this frame.

Parameters:
  • angle (float) – The rotation angle in degrees

  • x (float) – X value of the reference point for the rotation in points relative to the left edge of the image, not the frame.

  • y (float) – Y value of the reference point for the rotation in points relative to the left edge of the image, not the frame.

Return type:

None

Raises:
  • TypeError

    • When parameter types are invalid

    • When this frame is not an image frame

  • CometError – On internal error.

Available:

InDesign® comet_pdf®

CScript:

frame::image_rotate

CFrame.getImageSkew()

Get the current skew angle of the image in this frame.

Returns:

The current skew angle of the image

Return type:

float

Raises:
  • TypeError

    • When parameter types are invalid

    • When this frame is not an image frame

  • CometError – On internal error.

CFrame.setImageSkew(angle, x, y)

Skew the image of a graphic frame.

Parameters:
  • angle (float) – The skew angle

  • x (float) – X value of the reference point for the rotation in points relative to the left edge of the image, not the frame.

  • y (float) – Y value of the reference point for the rotation in points relative to the left edge of the image, not the frame.

Return type:

None

Raises:
  • TypeError

    • When parameter types are invalid

    • When this frame is not an image frame

  • CometError – On internal error

Available:

InDesign® comet_pdf®

CScript:

frame::image_skew

CFrame.getTableCount(start=0, length=-1)

Counts tables in the frame.

Parameters:
  • start (int) – The start index

  • length (int) –

    The length to search inside the text.

    Default is constants.kEnd = Search until the end

Returns:

The table count

Return type:

int

Raises:
  • TypeError

    • When the frame is not a text frame

    • When parameters start or index have wrong type

  • ValueError – When parameters start or index are invalid

  • CometError – On internal error

Available:

InDesign® comet_pdf®

CScript:

table::count

CFrame.getNthTable(index=0, start=0, length=-1)

Get a table from the frame. This queries the entire frame chain if the frame is linked.

Parameters:
  • index (int) – The table index to get

  • start (int) – Search from a specific start position

  • length (int) –

    The length to search inside the text.

    Default is constants.kEnd = Search until the end

Returns:

The found table

Return type:

CTable

Raises:
  • TypeError

    • When the frame is not a text frame

    • When parameters start or index have wrong type

  • ValueError – When parameters start or index are invalid

  • CometError – On internal error

Available:

InDesign® comet_pdf®

CScript:

table::get

CFrame.getBuiltElements()

Get all elements built by an repeating element placeholder. This function only yields valid results when this frame has a repeating element placeholder and has been built at least once.

Returns:

A list of built elements.

Return type:

list[CElement]

Available:

InDesign® comet_pdf®

CScript:

elementlist::get_area_built_elements

CFrame.getCometGroup(searchHierarchy=True)

Get the comet group ID of this frame.

Parameters:

searchHierarchy (bool) –

Search document hierarchy if the frame has no group ID?

Illustrator® Ignored

Returns:

The comet group or None if the frame does not belong to a group

Return type:

CCometGroup | None

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:

frame::get_cometgroup

CFrame.getCometGroupID(searchHierarchy=True)

Get the comet group ID of this frame.

Parameters:

searchHierarchy (bool) –

Search document hierarchy if the frame has no group ID?

Illustrator® Ignored

Returns:

The comet group ID or 0 if the frame does not belong to a group

Return type:

int

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:

frame::get_cometgroup

CFrame.setCometGroupID(ID)

Add a frame to a Comet group. If the frame is a parent frame of a comet group, the entire group is added as a subgroup.

Parameters:

ID (int) – The new comet group ID

Return type:

None

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:

frame::add_to_cometgroup

CFrame.removeFromCometGroup(ID=-1)

Detach a frame from a Comet group. The frame is then no longer assigned to any group, except for frames that are themselves the main frame of a group: this membership is retained.

If the Comet ID is -1, the frame is detached from any membership, otherwise only if it is a member of the specified group.

Parameters:

ID (int) –

The group ID to remove from.

  • -1: Remove from any group.

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:

frame::remove_from_cometgroup

Link all placeholders and all subframes with the given ID.

Parameters:
  • recordID

    The record ID to link the content to.

    The parameter type can be:

  • start (int) – The text start index to begin linking.

  • length (int) –

    The text length to link placeholders for.

    Default is constants.kEnd == link every placeholder until the text end

  • autoLoad (bool) –

    Should all placeholders be loaded after linking?

    See also

    load()

  • applyRules (bool) –

    Only relevant when *autoLoad* is true.

    Apply layout rules “After load” after successful execution?

  • changeStaticLinks (bool) – Overwrite static product links?

Return type:

None

Raises:
  • TypeError – When parameter types are invalid

  • ValueError

    • When parameter recordID has invalid value

    • When parameter start has invalid value

    • When parameter length has invalid value

  • CometError – On internal error

Available:

InDesign® comet_pdf® Illustrator®

CFrame.load(start=0, length=-1, applyRules=False, placeholderIDs=[], recordIDs=[])

Execute the load action for all placeholders of a frame or text including its sub-objects.

Parameters:
  • start (int) –

    The text start index to begin loading.

    Only evaluated for text frames.

  • length (int) –

    The text length to load placeholders for.

    Default is constants.kEnd == load every placeholder until the text end.

    Only evaluated for text frames.

  • applyRules (bool) – Apply layout rules “After load” after successful execution?

  • placeholderIDs (list[int]) –

    List of placeholderIDs to restrict loading to. Entries must be of type int

    • Empty list: Impose no restrictions

  • recordIDs (list[CIDType | tuple[int, int, int, str]]) –

    List of recordIDs to restrict loading to.

    • Empty list: Impose no restrictions

    The entry types can be:

Return type:

None

Raises:
  • TypeError – When parameter types are invalid

  • ValueError

    • When parameter start has invalid value

    • When parameter length has invalid value

  • CometError – On internal error

Available:

InDesign® comet_pdf® Illustrator®

CFrame.store(start=0, length=-1, placeholderIDs=[], recordIDs=[])

Execute the store action for all placeholders of a frame or text including its sub-objects.

Parameters:
  • start (int) –

    The text start index to begin storing.

    Only evaluated for text frames.

  • length (int) –

    The text length to store placeholders for.

    Default is constants.kEnd == store every placeholder until the text end.

    Only evaluated for text frames.

  • placeholderIDs (list[int]) –

    List of placeholderIDs to restrict storing to. Entries must be of type int

    • Empty list: Impose no restrictions

  • recordIDs (list[CIDType | tuple[int, int, int, str]]) –

    List of recordIDs to restrict storing to.

    • Empty list: Impose no restrictions

    The entry types can be:

Return type:

None

Raises:
  • TypeError – When parameter types are invalid

  • ValueError

    • When parameter start has invalid value

    • When parameter length has invalid value

  • CometError – On internal error

Available:

InDesign® comet_pdf® Illustrator®

CFrame.build()

Execute the build action of a frame. This action should normally create the repeating elements for this frame. The placeholder of the frame must be:

RelatedTo kMultiFrame (=6)

CharacterStyleID > 0

Return type:

None

Raises:

CometError – On internal error

Available:

InDesign® comet_pdf®

CFrame.getSmartItemData(key)

Get the frame properties to support products buildings.

Parameters:

key (int) –

Which property to fetch.

Results are:

  • 0: Frame label (Single character)

  • 1: Sequence number

  • 2: Type
    • 0 : Normal

    • 1 : Can continue

    • 2 : Repeat (not supported for now)

    • 3 : Can continue but do not change its height

  • 3: Rule to execute before inserting template

    • -3 : New right page

    • -2 : New left page

    • -1 : New page

  • 4: Use this frame in text flows?

    • 0 : Insert text content

    • 1 : Insert as inline

    • 2 : Do not use

  • 5: Use for builds?

    • 0 : Yes

    • 1 : Do not use

    • 2 : Use but ignore on reorganizations

  • 6: Bit field with additional info

    • 0x00000001 : Load frame place holder

    • 0x00000002 : Load text place holder

  • 7: Area type

    • 0 : Bounding Box

    • 1 : Path (star)

    • 2 : Path with holes (empty star)

    • 3 : ignore (minus)

Returns:

The stored value. The type depends on the data to fetch:

Return type:

str | int

Raises:
  • TypeError – When parameter types are invalid

  • ValueError – When parameter key has invalid value

Available:

InDesign® comet_pdf®

CScript:

frame::get_smart_item_data

CFrame.setSmartItemData(key, value)

Set the frame properties to support products buildings.

Parameters:
  • key (int) – Which property to set

  • value (str | int) –

    The value to set.

    See getSmartItemData() for possible parameter values. The type depends on the parameter key:

Return type:

None

Raises:
  • TypeError – When parameter types are invalid

  • ValueError – When parameter key has invalid value

Available:

InDesign® comet_pdf®

CScript:

frame::set_smart_item_data

CFrame.getNail(referencePoint)

Determine whether this frame has a nail at a specific reference point.

Parameters:

referencePoint (int) –

The reference point to query.

One of Reference Points.

Returns:

Nail type, edge nail prefers maximum size change.

Nail type can be:

  • 0 : No nail or error

  • 1 : Nail

  • 2 : Percent nail

  • 3 : Magnet (only if not pinned by a nail at this side)

  • 4 : Percent magnet (only if not pinned by a nail at this side)

Return type:

tuple[int, bool]

Raises:
Available:

InDesign® comet_pdf®

CScript:

frame::get_nail

CFrame.setNail(referencePoint, type, preferMax=False)

Set or remove priint:adjust nails.

Please note that due to the experimental nature of this function, it is not convered by support

Parameters:
  • referencePoint (int) –

    The reference point to change the nail for.

    One of Reference Points.

  • type (int) –

    The type of nail to set.

    • 0 : Remove

    • 1 : Normal (green) nail

    • 2 : Relative (red) nail

    • -1 : Toggle

  • preferMax (bool) –

    Edge type, for edge nails only and ignored if parameter type is -1

    • True : Prefer longer side

    • False : Prefer shorter side

Return type:

None

Raises:
  • TypeError – When parameter types are invalid

  • ValueError

    • When parameter referencePoint has invalid value

    • When parameter type has invalid value

  • CometError – On internal error

Available:

InDesign® comet_pdf®

CScript:

frame::set_nail

CFrame.getIncomingMagnets(side)

Get a list of all magnets that point to one side of this frame.

The first entry in the list is the ‘main’ magnet.

If other magnets point to the side, these are alternatives to this magnet.

Parameters:

side (int) –

The side to get the magnets for.

One of Sides

Returns:

The incoming (alternative) magnets.

Return type:

list[CMagnet]

Raises:
Available:

InDesign® comet_pdf®

CScript:

frame::incoming_magnets

CFrame.getOutgoingMagnets(side)

Get a list of all magnets that point from this frame to another frame at a specific side.

Parameters:

side (int) –

The side to get the magnets for.

One of Sides

Returns:

The outgoing magnets.

Return type:

list[CMagnet]

Raises:
Available:

InDesign® comet_pdf®

CScript:

frame::outgoing_magnets

CFrame.setMagnet(fromSide, target, targetSide, type=3, isImage=False, canAlt=False)

Set or remove magnet for priint::adjust.

For internal use only!

You can use the function, but please note that the function is not part of the support services.

Parameters:
  • fromSide (int) –

    The side to start the magnet at.

    One of Sides.

  • target (CFrame) – The target frame for the magnet.

  • targetSide (int) –

    The side at the target frame.

    One of Sides.

    Must be on the same axis as fromSide.

  • type (int) –

    The type of the magnet.

    Valid values are:

    • 3: Normal magnet

    • 4: Relative magnet

  • isImage (bool) –

    • True: Normal frame magnet.

    • False: Magnet to the target’s image.

  • canAlt (bool) –

    • True: If there is already a magnet to the target side, the new magnet is created as an alternative.

    • False: If there is already a magnet to the target side, this magnet is removed.

Return type:

None

Raises:
  • TypeError – When parameter types are invalid

  • ValueError

    • When parameter fromSide has invalid value.

    • When parameter targetSide has invalid value.

    • When parameter type has invalid value.

    • When parameters fromSide and targetSide are not on the same axis.

  • CometError – On internal error

CScript:

frame::set_magnet

CFrame.applyMagnets(applyRules=False, applyBuildActions=True)

Apply magnets of this frame.

This recursively updates all dependent frames aswell.

Parameters:
  • applyRules (bool) – Apply adapter rules of frames?

  • applyBuildActions (bool) – Apply rules of type “While building products” of frames?

Raises:
Available:

InDesign® comet_pdf®

CScript:

frame::apply_magnets

CFrame.removeMagnets(fullClosure=False)

Delete all magnets, nails and adapter scripts from this frame.

Parameters:

fullClosure (bool) –

  • False: Only edit this frame.

  • True: Also edit all frames that are connected to this frame via magnets.

Return type:

None

Raises:
Available:

InDesign® comet_pdf®

CScript:

frame::rmv_magnets

CFrame.applyLayoutRules(situation, callerData=None, recordID=None)

Apply layout rules of this frame.

Rules are not executed if the given rule type is suppressed.

Parameters:
Return type:

None

Available:

InDesign® comet_pdf® Illustrator®

Raises:
CScript:

frame::apply_layout_rules

CFrame.getPageElement(checkCometGroup=False, checkTopLeft=False, queryNearest=False)

Determine the page element in which a frame or the frame’s comet group is located.

The assignment to a page element is determined exclusively by the current XY position of the frame (or the comet group of the frame) and the current page template.

Parameters:
  • checkCometGroup (bool) –

    • False: Use the frame itself

    • True: Use the comet group of the frame

  • checkTopLeft (bool) –

    • False: The bounding box around the frame or the comet group must fit into the page element.

    • True: The upper left corner of the bounding box must be in the page element.

  • queryNearest (bool) –

    Behavior on overlapping elements.

    • False: Use the first element found (This is the element with the smallest sequence number.)

    • True: Use the element whose upper left corner is closest to the upper left corner of the frame/comet group

    The parameter is used only if checkTopLeft is True

Returns:

1-based page element sequence number, page element name

Return type:

tuple[int, str]

Raises:
Available:

InDesign® comet_pdf®

CScript:

frame::get_page_element

CFrame.getTemplate(getName=False)

Determine the template which inserted this frame into the document.

Parameters:

getName (bool) –

Whether to determine the template name from the active data connection.

  • False: Do not ask the data connection.

    The name in the result tuple is empty in this case.

  • True: Ask the data connection.

    The function will raise when the name could not be determined

Returns:

Template ID, template name

Return type:

tuple[int, str]

Raises:

CometError

  • On internal error

  • When parameter getName is True and the name could not be determined.

Available:

InDesign® comet_pdf®

CScript:

frame::get_template

CFrame.showsTextEnd()

Does the frame contain the end of the text?

Returns:

  • 0 : No (The frame either has an overset or it is linked to another text frame).

  • 1 : Yes, the text ends here.

  • 2The frame does not show any text.

    This case occurs when text frames are linked and the text does not extend to this frame.

Return type:

int

Available:

InDesign® comet_pdf® Illustrator®

Raises:
CScript:

frame::shows_textend

CFrame.duplicate(x=None, y=None, addToCometGroup=False, document=None, page=-1, layer='')

Duplicate this frame.

By default the new frame has no comet group. Set addToCometGroup to True to copy the original comet group ID.

Parameters:
  • x (None | float) –

    The new x coordinate for the duplicated frame.

    The parameter can type can be:

    • None:

      Use the coordinate of the source frame.

    • float:

      Page-relative coordinate in pt.

  • y (None | float) –

    The new y coordinate for the duplicated frame.

    The parameter can type can be:

    • None:

      Use the coordinate of the source frame.

    • float:

      Page-relative coordinate in pt.

  • addToCometGroup (bool) –

    Whether to add the duplicate to the same comet group as the original.

    If you duplicate into another document, the parameter has no effect!

  • document (CDocument | None) –

    The duplicate may be placed into a different document which can be designated here.

    • None: Place into same document as the original frame.

  • page (CPage | int) –

    The target page

    The parameter can type can be:

    • CPage:

      A page belonging to the same document as the parameter document (when it is set), or to the same document as the source frame

    • int:

      Page index

      • -1: Same as source frame

  • layer (CLayer | str) –

    The target layer

    The parameter can type can be:

    • CLayer:

      A layer belonging to the same document as the parameter document (when it is set), or to the same document as the source frame

    • str:

      A layer name.

      • Empty str: Same as the source frame

      When this layer does not exist yet, it is not automatically created. In this case the frame is placed on the default one.

Returns:

The newly duplicated frame

Return type:

CFrame

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:

frame::duplicate

Get the document link of this frame if any exists.

Returns:

The document link or None if none exists.

Return type:

CDocLink | None

Raises:

CometError – On internal error

Available:

InDesign® comet_pdf®

CScript:

frame::doclink::get

Special methods

CFrame.__repr__()

String representation.

Returns:

InDesign® comet_pdf®

<CFrame> UID: UID | Name: Name

Illustrator®

<CFrame> Name: Name

Example
<CFrame> UID: 1027 | Name: Placeholder frame 1

Return type:

str