← Back to LayoutBridge

Tool reference


All 110 tools that LayoutBridge makes available to your AI application – grouped by task, with description and parameters.

The descriptions are the exact text the server delivers to the AI application (as of 22 September 2026, read from the running server). In Claude Desktop the tools carry the prefix layoutbridge-spm:. Measurements are millimetres from the top left corner of the page (or, optionally, the spread); every tool replies with ok, warnings and – on failure – an error kind with a plain-text message. Tools marked read-only never change the document.

Application and documents13 tools

get_app_versionInDesign® versionread-only

Return the version string of the running InDesign application. Use it as a sign of life before anything else. Fails with app_not_available when InDesign is not running or not ready yet. Read-only.

No parameters.

list_documentsList open documentsread-only

List every open document, not just the frontmost one. Returns document_id (stable for this session), name, saved, path (empty when never saved), page_count and is_active. Read-only. Note: saved true is no reliable sign that there is nothing to save.

No parameters.

open_documentOpen a document

Open an existing .indd, .indt or .idml file. Returns document_id, name, page_count, facing_pages (Doppelseiten) and already_open, which is true when the file was open already – it is never opened twice. Because InDesign dialogs are suppressed, missing links (fehlende Verknuepfungen), out of date links and missing fonts (fehlende Schriften) come back as warnings; that is the only signal you get.

Parameters (3)
pathstringrequired
Real file path on the machine running InDesign. (min. 1 chars)
open_copyboolean
Open an untitled copy and leave the file untouched. Default for .indt templates.
show_windowboolean
Show the document window. Default true. Without a window the document is never the active one.

close_documentClose a document

Close a document. save_changes is required and has no default, because InDesign save dialogs are suppressed. Pass path to save under a new name; it is required for a document that has never been saved when save_changes is "yes". Returns saved_to, had_unsaved_changes and the remaining document ids. Note: merely opening a document can already set had_unsaved_changes true.

Parameters (3)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
save_changesstringrequired
Required. "yes" saves before closing, "no" discards unsaved changes. (values: "yes", "no")
pathstring
Save-as target path. Required when save_changes is "yes" and the document was never saved. (min. 1 chars)

create_documentCreate a document

Create a new document. Page size from preset (A4, Letter, Legal, Tabloid) or width_mm/height_mm, orientation portrait or landscape, pages (default 1), facing_pages (Doppelseiten, default true). margins_mm is required: { top, bottom, left, right } or { top, bottom, inside, outside } – for facing pages InDesign treats left as the inside margin (Bundsteg) and right as the outside margin. columns { count, gutter_mm } sets the column guides (Spaltenhilfslinien). Returns document_id and page_ids plus the page size InDesign actually set. The document is untitled until save_document. Note: if this call times out, the document may still have been created – check list_documents before repeating.

Parameters (8)
presetstring
Page size preset. Alternative to width_mm/height_mm. (values: "A4", "Letter", "Legal", "Tabloid")
width_mmnumber
Page width in millimetres. Overrides the preset width. (> 0)
height_mmnumber
Page height in millimetres. Overrides the preset height. (> 0)
orientationstring
Swaps width and height when they do not match. Default portrait. (values: "portrait", "landscape")
pagesinteger
Number of pages. Default 1. (≥ 1, ≤ 9999)
facing_pagesboolean
Facing pages (Doppelseiten). Default true.
margins_mmobjectrequired
Required. Margins (Stege) in millimetres: top/bottom plus left/right or inside/outside.
topnumberrequired
(≥ 0)
bottomnumberrequired
(≥ 0)
leftnumber
(≥ 0)
rightnumber
(≥ 0)
insidenumber
(≥ 0)
outsidenumber
(≥ 0)
columnsobject
Column guides: count and gutter (Spaltenabstand) in millimetres.
countintegerrequired
(≥ 1, ≤ 40)
gutter_mmnumber
(≥ 0)

save_documentSave a document

Save the document. With path it is a save-as (Speichern unter); without path the document is saved in place. A document that has never been saved needs path, otherwise the call fails with io_error. Returns path as InDesign reports it afterwards.

Parameters (2)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
pathstring
Target file path for save-as. Required for a document that has never been saved. (min. 1 chars)

save_document_asSave a copy or switch file

Write the document to another file: mode copy (default) saves a copy (Kopie speichern) and the open document keeps its own file – the way to start the next issue from the current one; mode switch saves under the new name and the open document continues there (Speichern unter). template true writes an .indt. An existing file needs overwrite true. Returns path, bytes, overwritten, name and document_path of the open document afterwards. save_document is for saving in place.

Parameters (5)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
pathstringrequired
Target file path, ending in .indd or .indt, in an existing folder. (min. 1 chars)
modestring
copy (default) or switch. (values: "copy", "switch")
templateboolean
Write as template (.indt / stationery). Default false.
overwriteboolean
Replace an existing file. Default false.

package_documentPackage for print

Package the document for the printer (Verpacken): a folder with the document, Links, Document fonts and a report; options copy_fonts, copy_graphics, update_graphics (default true), copy_profiles, include_hidden_layers, ignore_preflight_errors (default true), create_report (default true), include_idml, include_pdf with pdf_preset (default: the high quality preset). The document must be saved. Missing links and fonts come back as warnings and fields; InDesign refuses the package when preflight errors are not ignored. Returns folder_path, the options used, missing_links, missing_fonts, entries_in_folder, and the font list of the document with its package status: fonts[] {family, style, name, postscript_name, type (opentype_cff, opentype_tt, truetype, type1 …), status, location, packaged (true, false, or null when the file could not be matched), reason (not_installed, adobe_fonts, not_copied, copy_fonts_off, location_unknown, fonts_folder_missing)}, fonts_total, fonts_packaged_count, fonts_not_packaged[] and fonts_folder. The document font list includes fonts used only by unused styles (e.g. the basic paragraph style), so it can be longer than find_font_usage. Fonts activated through Adobe Fonts (Creative Cloud) are never copied by InDesign – a warning names them. Long operation (timeout 600 s).

Parameters (12)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
folder_pathstringrequired
Package folder (created or filled by InDesign); its parent folder must exist. (min. 1 chars)
copy_fontsboolean
Default true.
copy_graphicsboolean
Default true.
copy_profilesboolean
Default false.
update_graphicsboolean
Update links to the copied graphics. Default true.
include_hidden_layersboolean
Default false.
ignore_preflight_errorsboolean
Default true.
create_reportboolean
Write the instructions/report file. Default true.
include_idmlboolean
Also write an IDML. Default false.
include_pdfboolean
Also export a PDF with pdf_preset. Default false.
pdf_presetstring
PDF export preset name for include_pdf. (min. 1 chars)

export_pdfExport as PDF

Export the document (or a page_range) as PDF to path (the target file path – not output_path). Preset chain: preset (without it the localized built-in "High Quality Print" preset); when the result exceeds fallback_over_bytes it is exported again with fallback_preset (without both there is no second pass); a preset that does not exist falls back to the localized "High Quality Print" preset, then to the current export preferences, each with a warning. A spread preset turns single pages into spreads – check exported_page_count. The server configuration can hold default values for the three preset parameters; a parameter in the call always wins. page_range uses the printed page names as shown in InDesign ("6-8", "1, 3-5"; "+3" is the third page regardless of its name). Returns path, exported_page_count and document_page_count (page_count equals exported_page_count), bytes, preset_used and page_range_used. Pass fallback_over_bytes 0 or fallback_preset "" to disable the second pass. InDesign writes anywhere on the machine, also outside shared folders. Can take minutes on a full issue.

Parameters (6)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
pathstringrequired
Required. Target .pdf path on the machine running InDesign. (min. 1 chars)
page_rangestring
Pages to export, by printed page name, e.g. "6-8" or "1, 3-5". Default all.
presetstring
PDF export preset name (exact, as listed in InDesign). Default: the configured preset, otherwise the localized "High Quality Print".
fallback_presetstring
Preset for the second pass when the file exceeds fallback_over_bytes. Default: the configured preset, otherwise none. "" disables the second pass.
fallback_over_bytesinteger
Size threshold in bytes for the second pass. Default: the configured value, otherwise 0 = no second pass. (≥ 0)

export_page_imageExport pages as images

Export document pages as PNG or JPEG images, one file per page (for proofs, correction mails, the website or a measuring run without PDF). Select pages with page_ids (from list_pages) or page_range like export_pdf ("6-8", "1, 3-5", "+2"; printed page names). path is the target file; with several pages the page name is inserted before the extension (Seite.png → Seite_8.png). format png (default) or jpeg, dpi 36–600 (default 150), quality low/medium/high (default)/maximum, color_space rgb (default), gray or cmyk (jpeg only), transparent_background (png), use_bleed (include the bleed), anti_alias (default true). Master pages cannot be exported. The export preferences are set for this call only and restored. Returns format, dpi, count and files[] {page_id, page_name, path, bytes}. Read the files with an image tool of the client to check a layout visually. A timed-out call may still have written files – check the folder before repeating.

Parameters (11)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
pathstringrequired
Target file on the InDesign machine, e.g. /Users/.../Seite.png; the page name is inserted before the extension when several pages are exported. (min. 1 chars)
page_idsarray of integer
Pages to export, from list_pages. Alternative to page_range. (min. 1 items, max. 48 items)
page_rangestring
Page range against the printed page names, like export_pdf. Alternative to page_ids. (min. 1 chars)
formatstring
Image format. Default png. (values: "png", "jpeg")
dpinumber
Resolution in dpi. Default 150. (≥ 36, ≤ 600)
qualitystring
Compression quality. Default high. (values: "low", "medium", "high", "maximum")
color_spacestring
rgb (default), gray, or cmyk (jpeg only). (values: "rgb", "gray", "cmyk")
transparent_backgroundboolean
PNG only: transparent instead of white background. Default false.
use_bleedboolean
Include the document bleed (Anschnitt). Default false.
anti_aliasboolean
Smooth edges. Default true.

document_text_defaultsDocument text defaults

Read or set the document's text defaults (Textvorgaben) – the font, style, size and paragraph style every new text frame inherits and that set_text writes as local formatting. Without parameters it is read-only. Each setter works on its own; a failing one lands in problems[] without aborting the others. font takes a family name as InDesign shows it or "Family\tStyle" with a tab; font_style the style name ("Bold"); point_size 0–1296; paragraph_style the style name (not style_name). Returns the values after the change: font, font_style, point_size, paragraph_style, character_style, changed_fields[] and problems[].

Parameters (5)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
fontstring
Font family, or "Family\tStyle" with a tab character. (min. 1 chars)
font_stylestring
Font style name, e.g. "Regular", "Bold". (min. 1 chars)
point_sizenumber
Size in points. (> 0, ≤ 1296)
paragraph_stylestring
Paragraph style name to use as default. (min. 1 chars)

set_document_setupChange document setup

Change the document setup (Dokument einrichten) of an existing document: page size via preset (A4, Letter, Legal, Tabloid) or width_mm/height_mm, orientation (swaps width and height), facing_pages, pages (page count – a lower count deletes the last pages with their contents and needs allow_page_removal true), start_page_number. At least one parameter. Margins and bleed are set with set_layout_grid and set_document_bleed. Objects are not adjusted to a new page size. Returns setup (read back), previous, pages_added, pages_removed, changed; warns when the page size or facing pages changed.

Parameters (9)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
presetstring
Page size preset. (values: "A4", "Letter", "Legal", "Tabloid")
width_mmnumber
Page width in mm. (> 0)
height_mmnumber
Page height in mm. (> 0)
orientationstring
Swaps width and height when they do not match. (values: "portrait", "landscape")
facing_pagesboolean
Facing pages (Doppelseiten) on or off.
pagesinteger
Page count. Fewer than now deletes pages (allow_page_removal). (≥ 1, ≤ 9999)
allow_page_removalboolean
Confirm that a lower page count may delete pages with their contents.
start_page_numberinteger
Number of the first page (document preference; sections may override it). (≥ 1)

set_document_bleedSet bleed and slug

Set the document bleed (Anschnitt) and slug (Infobereich). bleed_mm and slug_mm each take a number (0–50, all edges) or an object with top/left/bottom/right; edges you leave out keep their value. Returns bleed_mm and slug_mm per edge plus bleed_uniform and slug_uniform. Independent of the bleed setting inside a PDF export preset. Read the current values with get_layout_grid.

Parameters (3)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
bleed_mmone of
Bleed in millimetres: one number for all edges or { top, left, bottom, right }.
number
(≥ 0, ≤ 50)
object
topnumber
(≥ 0, ≤ 50)
leftnumber
(≥ 0, ≤ 50)
bottomnumber
(≥ 0, ≤ 50)
rightnumber
(≥ 0, ≤ 50)
slug_mmone of
Slug in millimetres: one number for all edges or { top, left, bottom, right }.
number
(≥ 0, ≤ 50)
object
topnumber
(≥ 0, ≤ 50)
leftnumber
(≥ 0, ≤ 50)
bottomnumber
(≥ 0, ≤ 50)
rightnumber
(≥ 0, ≤ 50)

↑ Top

Pages, spreads, parent pages, sections15 tools

list_pagesList pagesread-only

List the document pages. Per page: page_id, index (0-based), side (LEFT_HAND, RIGHT_HAND or SINGLE_SIDED), parent (the applied master page, "[None]" when there is none) and name, which is the printed page number. Read-only. Master pages themselves are listed by list_parent_pages.

Parameters (1)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.

get_page_stateSnapshot of one pageread-only

Snapshot of one page: page_bounds_mm and every object on it with id, type (text, image, rectangle, ellipse, polygon, line, group, other), bounds_mm, paragraph_style when the whole frame uses one, a text_snippet of up to 200 characters, child_count, parent_group_id and layer_name (Ebene; see list_layers for locked or hidden layers). Nothing is skipped silently; unknown kinds come back as "other". Works for master pages too – take the page_id from list_parent_pages, the answer then carries is_parent_page true. All coordinates are millimetres from the top left corner of that page. Read-only. Careful: an object bleeding over the edge to the neighbouring page can show up with x = 210 instead of 0 – do not judge by coordinates alone, measure in the exported PDF. Returns coordinate_space "page": every bounds_mm is relative to the top left corner of this page and can be passed back to set_frame_bounds together with page_id.

Parameters (3)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
page_idintegerrequired
Page to look at, from list_pages or list_parent_pages.
include_group_childrenboolean
Also list the objects inside groups, each with parent_group_id. Default true.

show_pageShow a page in the layout window

Turn the layout window of the document to a page and fit it – for demonstrations, screen recordings and for checking a page by eye. Address the page by page_id (from list_pages, or a master page from list_parent_pages) or by page_name (the printed page number as list_pages shows it; with sections restarting the numbering the first match is shown with a warning). fit: page (default, centres the page), spread (the whole Druckbogen – InDesign then reports the left page of the spread as active_page, so compare active_spread_id), pasteboard, actual_size (100 %) or none (keep the current zoom); zoom (5–4000 percent) is applied after fit and overrides it. activate true brings the window to the front (default false – other documents stay where they are). Changes only the view, never the document. Fails with invalid_state when the document has no layout window (opened with show_window false). Returns page_id, page_name, is_parent_page, fit, zoom_percentage, view {active_page_id, active_page_name, active_spread_id, is_parent_page, zoom_percentage} read back, and previous_view. Tools that add pages (add_page, create_parent_page, place_text_file with autoflow) keep the view by default (keep_view).

Parameters (6)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
page_idinteger
Page to show, from list_pages or list_parent_pages. Either page_id or page_name.
page_namestring
Printed page number as list_pages shows it. Either page_id or page_name. (min. 1 chars)
fitstring
How to fit the view. Default page. (values: "page", "spread", "pasteboard", "actual_size", "none")
zoomnumber
Zoom in percent (5–4000), applied after fit. (≥ 5, ≤ 4000)
activateboolean
Bring the window to the front. Default false.

add_pageAdd a page

Add a page at "start", at "end" (default) or relative to a page: { after_page_id } or { before_page_id } – not position or at_index. Returns page_id, index, name and spread_page_count of the spread (Druckbogen) the page landed on, with a warning when that spread now has more than two pages (with "allow pages to shuffle" off InDesign appends to the existing spread; repair with move_pages_to_new_spread). New pages do not inherit a master page – call apply_parent_to_page. The layout window keeps its view (keep_view, default true); pass keep_view false to let InDesign show the new page, or call show_page.

Parameters (3)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
atone of
"start", "end", { after_page_id } or { before_page_id }. Default "end".
string
(values: "start", "end")
object
after_page_idintegerrequired
object
before_page_idintegerrequired
keep_viewboolean
Restore the previous view (page and zoom of the layout window) afterwards – InDesign otherwise jumps to the new page. Default true; false lets the view move. The answer carries view_restored (null when the document has no window).

delete_pageDelete a page

Delete a page. There is no undo. Master page objects and empty frames do not block (they are reported and go with the page); frames with text or images and threaded frames (verkettete Rahmen) block – the call then fails with invalid_state and lists them, and only force true deletes anyway. The only page of a document and master pages are always protected. Objects on the pasteboard (Montagefläche) belong to the spread, not to the page: when the spread goes with the page (the page is the only one of its spread), its pasteboard objects are listed before anything happens. When InDesign regroups the spreads (facing pages with "allow pages to shuffle"), pasteboard objects stay but can end up beside other pages. on_pasteboard_items decides: "warn" (default) deletes them with the page and warns, "abort" fails with invalid_state and details.code "pasteboard_items_present" (nothing deleted), "move" first moves them to the pasteboard of the spread of pasteboard_target_page_id (same position beside the pages; right stays right). Returns page_id, name, former_index, items_deleted, boilerplate_ignored and item_summary[]; also on_pasteboard_items, pasteboard_items[] {frame_id, type, spread_index, bounds_mm (spread coordinates), link_name, link_path, text_snippet}, pasteboard_moved_ids[], pasteboard_lost_ids[] (checked after deleting; a warning names every loss) and pasteboard_relocated[] {frame_id, spread_page_ids_before, spread_page_ids, spread_page_names_before (names before deleting), spread_page_names, spread_index, bounds_mm_before, bounds_mm, on_pasteboard} for pasteboard objects that now lie beside other pages or elsewhere (a warning names them); changes.removed_page_ids. Read list_pages again afterwards.

Parameters (5)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
page_idintegerrequired
Page to delete, from list_pages.
forceboolean
Delete even when frames with content or threaded frames are on the page.
on_pasteboard_itemsstring
What happens to pasteboard objects of a spread that goes with the page: "warn" (default) delete and warn, "abort" fail with details.code pasteboard_items_present, "move" move them to the spread of pasteboard_target_page_id first. (values: "warn", "abort", "move")
pasteboard_target_page_idinteger
Document page whose spread receives the pasteboard objects with on_pasteboard_items "move"; must lie on a spread that stays.

move_pagesMove pages

Move a block of neighbouring pages (1–48 page_ids, direct neighbours) before or after reference_page_id, which must lie outside the block. allow_page_shuffle overrides "allow document pages to shuffle" for this call only. Warnings: moving an odd number of pages flips the left/right side of every page in between; with shuffle off the pages join the target spread, and spread_page_counts shows overfilled spreads – a spread with more than two pages is a warning that spells out the new spread division (Bogenaufteilung). InDesign holds at most 10 pages on a spread: when the target spread would exceed that, the call fails before anything moves (invalid_state, details.code "spread_page_limit" with spread_index and predicted_page_count). keep_spreads true rebuilds the spreads between the old and the new place as pairs afterwards (facing pages: left and right page together, each on its left/right side, starting like the first page of the document; single-sided: one page per spread; a page that does not end up on its expected side is a warning) – the new spreads keep their pages when pages shuffle later (like move_pages_to_new_spread). Returns moved_page_ids, names_before, names_after, page_count, spread_count, spread_page_counts[], pages[] {page_id, index, name, side, spread_index}, keep_spreads and spreads_rebuilt.

Parameters (6)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
page_idsarray of integerrequired
Pages to move – direct neighbours in the page order. (min. 1 items, max. 48 items)
reference_page_idintegerrequired
Page the block is placed before or after. Must not be part of the block.
positionstringrequired
Where relative to the reference page. (values: "before", "after")
allow_page_shuffleboolean
Override "allow document pages to shuffle" for this call only.
keep_spreadsboolean
Rebuild the affected spreads as pairs after moving. Default false (spreads stay as InDesign leaves them).

move_pages_to_new_spreadMove pages to a new spread

Take a run of pages (1–24 page_ids, not page_id) out of their spread (Druckbogen) into a new spread directly behind it – the page order stays, only the spread division changes. Repairs a three-page spread after add_page. The pages must lie on the same spread, be direct neighbours and must not be all pages of that spread. Shuffle is suspended for the call and the new spread is created with shuffle off. Returns moved_page_ids, names, new_spread_index, new_spread_page_count, source_spread_index, source_spread_page_count, spread_count and page_count. Read list_pages and get_layout_grid again afterwards.

Parameters (2)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
page_idsarray of integerrequired
Pages to move into the new spread – same spread, direct neighbours, not all of them. (min. 1 items, max. 24 items)

list_parent_pagesList master pagesread-only

List the master spreads (Musterseiten): name ("A-Cover"), prefix, base_name, applied_to_page_ids[] and pages[] with page_id, index, side and item_count. Those page_ids make master pages readable and editable with get_page_state, set_text or find_replace (scope frame). Read-only.

Parameters (1)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.

create_parent_pageCreate a master page

Create a master spread (Musterseite) with base_name (1–60 characters) and name_prefix (one capital letter; InDesign picks the next free one when omitted). facing defaults to the document's facing-pages setting. page_count (1–10) sets the number of pages of the master spread directly – also in a single-sided document, where facing true alone still gives one page. based_on names an existing master (full name with prefix) the new one is based on (Musterseite basiert auf); "[None]" for none. Returns name, page_ids[], page_count and based_on ("[None]" when none). InDesign switches the layout window to the new master spread when it is created; keep_view (default true) puts the previous page and zoom back afterwards (view_restored) – pass keep_view false to stay on the master, or call show_page with one of the page_ids to work on it visibly.

Parameters (7)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
base_namestringrequired
Name without prefix, e.g. "Grundlayout". (min. 1 chars)
name_prefixstring
One capital letter. Default: next free letter.
facingboolean
Two-page master. Default: like the document.
page_countinteger
Pages of the master spread (1–10), also in a single-sided document. Overrides facing; a contradicting facing value is refused. (≥ 1, ≤ 10)
based_onstring
Full name of the master this one is based on, e.g. "A-Grundlayout"; "[None]" for none. Default: none. (min. 1 chars)
keep_viewboolean
Restore the previous view (page and zoom of the layout window) afterwards – InDesign otherwise jumps to the new page. Default true; false lets the view move. The answer carries view_restored (null when the document has no window).

duplicate_parent_pageDuplicate a master page

Duplicate a master spread (Musterseite duplizieren) with all its pages and objects: source_name is the full name with prefix (e.g. "A-Grundlayout"); base_name (1–60 characters) names the copy – without it the copy keeps the base name of the source; name_prefix (one capital letter) – without it InDesign picks the next free letter. The copy keeps the master it is based on. A full name that exists already is refused with invalid_state. Returns name, prefix, base_name, page_ids[], page_count, source_name, based_on, item_count and source_item_count (a warning when they differ). The layout window keeps its view (keep_view, default true).

Parameters (5)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
source_namestringrequired
Full name of the master to copy, with prefix, from list_parent_pages. (min. 1 chars)
base_namestring
Name of the copy without prefix. Default: the base name of the source. (min. 1 chars)
name_prefixstring
One capital letter. Default: next free letter.
keep_viewboolean
Restore the previous view (page and zoom of the layout window) afterwards – InDesign otherwise jumps to the new page. Default true; false lets the view move. The answer carries view_restored (null when the document has no window).

apply_parent_to_pageApply a master page

Apply the master spread parent_name (full name with prefix, e.g. "A-Footer") to page_id. "[None]", "none" or "Ohne" detaches the page from its master – an ad page loses header, footer line and page number in one step. Returns page_id and parent_applied as InDesign reports it afterwards.

Parameters (3)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
page_idintegerrequired
Page from list_pages (or a master page from list_parent_pages).
parent_namestringrequired
Full master name with prefix, or "[None]" to detach.

override_parent_item_on_pageOverride a master item

Make a local copy of a master page object on page_id so it can be edited there. parent_item_id must lie on a master spread (take it from get_page_state on a master page). Returns frame_id of the new local object.

Parameters (3)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
page_idintegerrequired
Document page that shows the master item.
parent_item_idintegerrequired
Object id on the master spread.

insert_page_number_markerInsert page number marker

Insert the automatic page number placeholder (Seitenzahl-Platzhalter) into text frame frame_id at position "start" or "end" (default end). Works on master page frames too. Returns frame_id and position.

Parameters (3)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Text frame to write into.
positionstring
Default "end". (values: "start", "end")

list_sectionsList sectionsread-only

List the sections (Abschnitte) of the document that control page numbering: sections[] {section_id, name, start_page_id, start_page_name, start_page_index, length, continue_numbering, page_number_start, page_number_style (arabic, upper_roman, lower_roman, upper_letters, lower_letters, or a custom list name), section_prefix, include_section_prefix, marker}, count, and pages[] {page_id, name} with the page names as they result. Read-only. Every document has a section on its first page.

Parameters (1)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.

set_sectionStart or change a section

Start a section on page_id or change the one starting there: page_number_start (sets continue_numbering false), continue_numbering, page_number_style (arabic, upper_roman, lower_roman, upper_letters, lower_letters), section_prefix (up to 8 characters), include_section_prefix, marker (text for the section marker), name. remove true deletes the section starting on page_id (never the first). Returns created, section (read back), previous, sections[] and pages[] {page_id, name} – page names change with the numbering, so re-read them before using page names in export_pdf ranges. Use it for an issue that starts at page 3, roman front matter, or a supplement with its own numbering.

Parameters (10)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
page_idintegerrequired
Document page on which the section starts (from list_pages).
page_number_startinteger
Page number of the first page of the section; implies continue_numbering false. (≥ 1)
continue_numberingboolean
true: continue from the previous section.
page_number_stylestring
Numbering style. (values: "arabic", "upper_roman", "lower_roman", "upper_letters", "lower_letters")
section_prefixstring
Prefix before the page number, up to 8 characters.
include_section_prefixboolean
Show the prefix in page numbers.
markerstring
Section marker text (Abschnittsmarke).
namestring
Section name.
removeboolean
Remove the section starting on page_id. Not combinable with other settings.

↑ Top

Layout grid, guides, layers7 tools

get_layout_gridLayout grid (Satzspiegel)read-only

Read the type area (Satzspiegel) of every document page and, by default, every master page, plus document-wide values. Per page: page_id, name, spread_index, spread_page_count, spread_position, page_offset_in_spread_mm, parent, margins_mm (top, bottom, left, right; for facing pages also inside = left and outside = right – InDesign stores the inside margin (Bundsteg) as "left"), column_count, column_gutter_mm, type_area_mm {x, y, width, height} measured from the top left corner of that page, column_width_mm, columns_positions_mm (from the left edge of the type area; a two-column grid with 5 mm gutter on 170 mm reads [0, 82.5, 87.5, 170]) and custom_column_positions. Document-wide: distinct_grids[] {margins_mm, columns, gutter_mm, page_ids}, is_uniform, baseline_grid {start_mm, increment_mm, increment_pt, relative_to (top_of_page, top_of_margin or unknown), relative_to_raw, shown, view_threshold}, baseline_grid_check {first_line_mm, starts_at_type_area_top, lines_in_type_area, last_line_mm, remainder_below_mm} for the first document page, bleed_mm {top, left, bottom, right, uniform} and slug_mm. Warnings: bleed 0, baseline grid does not fit the type area, relative_to unknown. Read-only.

Parameters (2)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
include_parent_pagesboolean
Also include master pages (Musterseiten). Default true.

set_layout_gridSet margins and columns

Set margins, column count and gutter on document pages and, by default, master pages, and redistribute the column guides evenly (relative to the type area). Whatever is omitted stays as it is. margins_mm takes top, left, bottom, right in mm – for facing pages "left" is the inside margin (Bundsteg) and "right" the outside margin. column_count 1–30, column_gutter_mm. page_ids[] limits the change to those pages (document or master pages); without it every page and the document defaults for new pages are changed – a client may block one call over all pages, so pass page_ids in blocks if needed. Optional baseline_grid {start_mm, increment_pt, relative_to: top_of_page | top_of_margin} sets the document baseline grid (Grundlinienraster). Moves only guides, never frames. Returns changed_pages[] {page_id, name, margins_mm, column_count, column_gutter_mm, type_area_mm, column_width_mm, columns_positions_mm} read back from InDesign, with a warning per page whose column positions do not lie on the even grid. A timed-out call may still have completed in InDesign – check with get_layout_grid before repeating.

Parameters (7)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
margins_mmobject
Margins in mm; omitted edges stay.
topnumber
(≥ 0)
leftnumber
Inside margin (Bundsteg) on facing pages. (≥ 0)
bottomnumber
(≥ 0)
rightnumber
Outside margin on facing pages. (≥ 0)
column_countinteger
Number of columns, 1–30. (≥ 1, ≤ 30)
column_gutter_mmnumber
Gutter (Spaltenabstand) in mm. (≥ 0)
page_idsarray of integer
Pages to change (document or master pages). Without it: all pages plus the document defaults. (min. 1 items)
include_parent_pagesboolean
Also include master pages (Musterseiten). Default true.
baseline_gridobject
Document baseline grid (Grundlinienraster); document-wide, not per page.
start_mmnumber
Start of the baseline grid in mm. (≥ 0)
increment_ptnumber
Line increment in points, e.g. 12. (> 0)
relative_tostring
Where start_mm is measured from. (values: "top_of_page", "top_of_margin")

list_guidesList ruler guidesread-only

List every ruler guide (Hilfslinie) of the document – not margin or column guides – from document spreads and, by default, master spreads, merged by id. Per guide: guide_id, orientation (horizontal or vertical), spread_index, is_parent_spread, page_id (null for a horizontal guide on a multi-page spread), page_name, position_spread_mm, position_page_mm, fit_to_page, locked, layer and color. Also guides_locked_globally, count_document and count_parent. Read-only.

Parameters (2)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
include_parent_pagesboolean
Also include master pages (Musterseiten). Default true.

delete_guidesDelete ruler guides

Delete ruler guides (Hilfslinien). Pass exactly one selection: guide_ids[] (from list_guides), page_ids[] (every guide on the spreads of those pages) or confirm_all true (every guide in the document); an empty call is refused. include_parent_pages (default true) also covers master spreads. Individual locks, "lock guides" and layer locks are lifted for the call and restored. Margin and column guides are never touched. There is no undo. Returns deleted[] {guide_id, orientation, position, page}, failed[] {guide_id, reason}, remaining_document and remaining_parent.

Parameters (5)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
guide_idsarray of integer
Guides to delete, from list_guides. (min. 1 items)
page_idsarray of integer
Delete every guide on the spreads that hold these pages. (min. 1 items)
confirm_allboolean
true deletes every guide in the document.
include_parent_pagesboolean
Also include master pages (Musterseiten). Default true.

list_layersList layersread-only

List the layers (Ebenen) of the document in panel order: layers[] {layer_id, name, index (0 = topmost), visible, locked, printable, ignore_wrap, show_guides, lock_guides, item_count (objects on the layer, document and parent pages)}, count, active_layer_id (where new objects land), hidden_count, locked_count, non_printing_count. Read-only. A locked layer makes every writing tool on its objects fail; a hidden layer hides them; a non-printing layer drops them from PDF exports – read this before you wonder why a call fails or a page looks empty.

Parameters (1)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.

set_frame_layerMove object to a layer

Move an object (frame, line, group) to another layer (Ebene). Pass layer_name or layer_id; with create_if_missing true a missing layer_name is created on top (warning). Members of a group cannot be moved separately (invalid_state; move the group). Fails with invalid_state when the object lies on a locked layer, is itself locked, or the target layer is locked – unlock with set_layer_visibility first. Returns layer_id, layer_name, previous_layer_id, previous_layer_name, layer_created, changed; warns when the target layer is hidden.

Parameters (5)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Object id from get_page_state.
layer_namestring
Layer name (Ebene), exact, as list_layers returns it. Pass either layer_name or layer_id. (min. 1 chars)
layer_idinteger
Layer id from list_layers. Pass either layer_name or layer_id.
create_if_missingboolean
Create the layer named layer_name on top when it does not exist. Default false.

set_layer_visibilityShow, hide, lock or unlock a layer

Set visible, locked and/or printable on one layer (Ebene): at least one of the three. Pass layer_name or layer_id. Returns the layer state after the change, previous {visible, locked, printable}, item_count and changed. Warns when a layer with objects is hidden and when a layer is set to not print (its objects vanish from PDF exports). Unlocking is the fix when writing tools fail on objects of a locked layer.

Parameters (6)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
layer_namestring
Layer name (Ebene), exact, as list_layers returns it. Pass either layer_name or layer_id. (min. 1 chars)
layer_idinteger
Layer id from list_layers. Pass either layer_name or layer_id.
visibleboolean
Show (true) or hide (false) the layer.
lockedboolean
Lock (true) or unlock (false) the layer.
printableboolean
Print/export (true) or not (false).

↑ Top

Creating frames and objects11 tools

create_text_frameCreate a text frame

Create an empty text frame on page_id (document or master page) at bounds_mm {x, y, width, height}; x/y may be negative for bleed. initial_text is put in as one paragraph – "\n" becomes a forced line break, not a new paragraph; for real paragraphs create the frame empty and use set_text. The frame inherits the document text defaults, vertical justification and text wrap (Textumfluss): with wrap on, text frames underneath can be pushed into overset – pass text_wrap "none" to switch it off at creation, and vertical_justification "top" to pin the text to the top. Frame options (Textrahmenoptionen): first_baseline_offset sets the first baseline (Versatz erste Grundlinie: ascent, cap_height, leading, x_height, fixed, embox_top) with min_first_baseline_pt as the minimum in points; ignore_text_wrap true lets this frame ignore wrap of other objects (e.g. a caption over a picture with wrap); inset_mm sets the inset (Innenabstand) as one number or {top, left, bottom, right}. A one-line caption in a frame of exactly one grid line needs first_baseline_offset appropriate to the style (ascent or fixed) – otherwise it goes into overset. Returns frame_id, bounds_mm (read back, relative to the page it landed on), landed_on_page_id and landed_on_page_name (empty = pasteboard), and the frame options read back; a landing on another page is a warning, never a silent success. A timed-out call may still have created the frame – check get_page_state before repeating. Placeholders in the text become InDesign special characters (placeholders true, default): {{line_break}} (forced line break within the paragraph), {{nbsp}} (no-break space U+00A0), {{nbsp_fixed}} (fixed-width no-break space U+202F), {{thin_space}}, {{hair_space}}, {{soft_hyphen}} (discretionary hyphen), {{nb_hyphen}} (no-break hyphen), {{en_dash}}, {{em_dash}}, {{tab}}, {{column_break}}, {{frame_break}}, {{page_break}}. Unknown {{…}} stay as written with a warning; each placeholder is exactly one character in the story. Returns placeholders_replaced {name: count} and placeholders_unknown[].

Parameters (12)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
page_idintegerrequired
Page from list_pages or list_parent_pages.
bounds_mmobjectrequired
Position and size in mm from the top left corner of the page (or spread with coordinate_space "spread").
xnumberrequired
Left edge in mm; negative allowed for bleed (Anschnitt).
ynumberrequired
Top edge in mm; negative allowed.
widthnumberrequired
Width in mm, greater than 0. (> 0)
heightnumberrequired
Height in mm, greater than 0. (> 0)
coordinate_spacestring
Reference for x/y: "page" (default) is the top left corner of page_id, identical on left and right pages; "spread" is the top left corner of the spread (Druckbogen) – the right page of a spread starts at x = page width. (values: "page", "spread")
initial_textstring
Text for the frame, one paragraph; "\n" is a line break. Placeholders such as {{nbsp}} are expanded.
placeholdersboolean
Expand {{…}} placeholders into special characters. Default true; false writes them literally.
text_wrapstring
"none" switches text wrap off for this frame. (values: "none")
vertical_justificationstring
Vertical alignment of the text inside the frame. (values: "top", "center", "bottom", "justify")
first_baseline_offsetstring
Position of the first baseline (Versatz erste Grundlinie). Default is the document default, usually ascent. (values: "ascent", "cap_height", "leading", "x_height", "fixed", "embox_top")
min_first_baseline_ptnumber
Minimum first baseline offset in points (Min. in the frame options). (≥ 0)
ignore_text_wrapboolean
true: this frame ignores text wrap of other objects (Textumfluss ignorieren).
inset_mmone of
Inset (Innenabstand) in mm: one number for all edges or {top, left, bottom, right}; missing edges are 0.
number
(≥ 0)
object
topnumber
(≥ 0)
leftnumber
(≥ 0)
bottomnumber
(≥ 0)
rightnumber
(≥ 0)

create_image_frameCreate an image frame

Create an empty graphic frame (Bildrahmen) on page_id at bounds_mm; x/y may be negative for bleed. By default fill and stroke are set to [None] and the stroke weight to 0 pt, so nothing prints around the picture (appearance_cleared true); keep_default_appearance true keeps the document defaults. The frame is set to fit a picture proportionally when place_image fills it later. Returns frame_id, bounds_mm, appearance_cleared, landed_on_page_id and landed_on_page_name; a landing on another page is a warning. If a 1 pt stroke still shows in an export, run set_frame_appearance with stroke_weight_pt 0. A timed-out call may still have created the frame – check get_page_state before repeating.

Parameters (5)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
page_idintegerrequired
Page from list_pages or list_parent_pages.
bounds_mmobjectrequired
Position and size in mm from the top left corner of the page (or spread with coordinate_space "spread").
xnumberrequired
Left edge in mm; negative allowed for bleed (Anschnitt).
ynumberrequired
Top edge in mm; negative allowed.
widthnumberrequired
Width in mm, greater than 0. (> 0)
heightnumberrequired
Height in mm, greater than 0. (> 0)
coordinate_spacestring
Reference for x/y: "page" (default) is the top left corner of page_id, identical on left and right pages; "spread" is the top left corner of the spread (Druckbogen) – the right page of a spread starts at x = page width. (values: "page", "spread")
keep_default_appearanceboolean
true keeps the document default fill and stroke. Default false = fill and stroke [None], stroke 0 pt.

create_rectangleCreate a rectangle

Create a rectangle on page_id at bounds_mm (x/y may be negative) with optional fill_hex, stroke_hex, stroke_weight_pt (points), corner_radius_mm and corner_type, fill_tint_percent, stroke_tint_percent, gradient_fill_angle_deg, gradient_stroke_angle_deg, layer_name and name. Hex colours become RGB swatches named after the value ("#1A2B3C"), reused when they exist; their ids come back as swatch_ids. For print use the existing document swatches (CMYK) instead: fill_swatch_name / stroke_swatch_name take the exact name of an existing colour, tint or gradient swatch (see list_swatches, create_gradient_swatch); each excludes the corresponding hex parameter. Without fill_hex the fill is [None]; without stroke_hex and stroke_weight_pt the stroke is [None] with 0 pt. The rectangle inherits the document text wrap (Textumfluss) – pass text_wrap "none" to switch it off, or build borders from four create_line calls. Returns frame_id, page_id, swatch_ids, bounds_mm, fill_color, fill_kind (none, color, tint, gradient, mixed_ink), stroke_color, stroke_kind, tints, gradient angles, corner_type, corners, layer_name, landed_on_page_id and landed_on_page_name. A timed-out call may still have created the rectangle – check get_page_state before repeating.

Parameters (18)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
page_idintegerrequired
Page from list_pages or list_parent_pages.
bounds_mmobjectrequired
Position and size in mm from the top left corner of the page (or spread with coordinate_space "spread").
xnumberrequired
Left edge in mm; negative allowed for bleed (Anschnitt).
ynumberrequired
Top edge in mm; negative allowed.
widthnumberrequired
Width in mm, greater than 0. (> 0)
heightnumberrequired
Height in mm, greater than 0. (> 0)
coordinate_spacestring
Reference for x/y: "page" (default) is the top left corner of page_id, identical on left and right pages; "spread" is the top left corner of the spread (Druckbogen) – the right page of a spread starts at x = page width. (values: "page", "spread")
fill_hexstring
Fill colour as hex, e.g. "#E30613". Creates an RGB swatch.
fill_swatch_namestring
Exact name of an existing swatch for the fill – colour, tint or gradient swatch (see list_swatches). Not together with fill_hex. (min. 1 chars)
stroke_hexstring
Stroke colour as hex. Creates an RGB swatch.
stroke_swatch_namestring
Exact name of an existing swatch for the stroke (colour, tint or gradient). Not together with stroke_hex. (min. 1 chars)
stroke_weight_ptnumber
Stroke weight in points (1 pt with a warning when a stroke colour is given without it). (≥ 0)
fill_tint_percentnumber
Tint of the fill swatch in percent (0–100). (≥ 0, ≤ 100)
stroke_tint_percentnumber
Tint of the stroke swatch in percent (0–100). (≥ 0, ≤ 100)
gradient_fill_angle_degnumber
Angle of a linear gradient fill in degrees (-180 to 180); only visible with a gradient swatch as fill. (≥ -180, ≤ 180)
gradient_stroke_angle_degnumber
Angle of a linear gradient stroke in degrees (-180 to 180); only visible with a gradient swatch as stroke. (≥ -180, ≤ 180)
text_wrapstring
Text wrap of the new object: none, bounding_box or object_shape. Without it the document default applies – pass "none" when text lies underneath. (values: "none", "bounding_box", "object_shape")
layer_namestring
Existing layer to create the object on (see list_layers). Default: the active layer. (min. 1 chars)
namestring
Object name (label), shown in InDesign's layers panel.
corner_radius_mmnumber
Corner radius in mm for all four corners. (≥ 0)
corner_typestring
Corner shape (Eckenoptionen) for all four corners: none, rounded, inverse_rounded, bevel, inset, fancy. Default rounded when corner_radius_mm is greater than 0, otherwise none. Per-corner settings: set_corner_options. (values: "none", "rounded", "inverse_rounded", "bevel", "inset", "fancy")

create_ellipseCreate an ellipse or circle

Create an ellipse (Ellipse) as a frame without content on page_id at bounds_mm – the bounding rectangle without the stroke; width equal to height gives a circle. Colour, stroke, tint, gradient angle, text_wrap, layer_name and name as in create_rectangle: fill_hex / fill_swatch_name (colour, tint or gradient swatch), stroke_hex / stroke_swatch_name, stroke_weight_pt (a stroke colour without weight gets 1 pt with a warning), fill_tint_percent, stroke_tint_percent, gradient_fill_angle_deg (only with a gradient swatch), text_wrap none | bounding_box | object_shape (without it the document default – pass "none" when text lies underneath). Without colours the fill and stroke are [None] with 0 pt, so nothing prints. Returns frame_id, type "ellipse", bounds_mm, page_id, landed_on_page_id, landed_on_page_name, fill_color, fill_kind (none, color, tint, gradient), stroke_color, stroke_kind, stroke_weight_pt, fill_tint_percent, gradient_fill_angle_deg, text_wrap_mode, layer_name, swatch_ids (empty when only swatch names were used). Use place_image to put a picture into it. A timed-out call may still have created the object – check get_page_state before repeating.

Parameters (16)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
page_idintegerrequired
Page from list_pages or list_parent_pages.
bounds_mmobjectrequired
Position and size in mm from the top left corner of the page (or spread with coordinate_space "spread").
xnumberrequired
Left edge in mm; negative allowed for bleed (Anschnitt).
ynumberrequired
Top edge in mm; negative allowed.
widthnumberrequired
Width in mm, greater than 0. (> 0)
heightnumberrequired
Height in mm, greater than 0. (> 0)
coordinate_spacestring
Reference for x/y: "page" (default) is the top left corner of page_id, identical on left and right pages; "spread" is the top left corner of the spread (Druckbogen) – the right page of a spread starts at x = page width. (values: "page", "spread")
fill_hexstring
Fill colour as hex, e.g. "#E30613". Creates an RGB swatch.
fill_swatch_namestring
Exact name of an existing swatch for the fill – colour, tint or gradient swatch (see list_swatches). Not together with fill_hex. (min. 1 chars)
stroke_hexstring
Stroke colour as hex. Creates an RGB swatch.
stroke_swatch_namestring
Exact name of an existing swatch for the stroke (colour, tint or gradient). Not together with stroke_hex. (min. 1 chars)
stroke_weight_ptnumber
Stroke weight in points (1 pt with a warning when a stroke colour is given without it). (≥ 0)
fill_tint_percentnumber
Tint of the fill swatch in percent (0–100). (≥ 0, ≤ 100)
stroke_tint_percentnumber
Tint of the stroke swatch in percent (0–100). (≥ 0, ≤ 100)
gradient_fill_angle_degnumber
Angle of a linear gradient fill in degrees (-180 to 180); only visible with a gradient swatch as fill. (≥ -180, ≤ 180)
gradient_stroke_angle_degnumber
Angle of a linear gradient stroke in degrees (-180 to 180); only visible with a gradient swatch as stroke. (≥ -180, ≤ 180)
text_wrapstring
Text wrap of the new object: none, bounding_box or object_shape. Without it the document default applies – pass "none" when text lies underneath. (values: "none", "bounding_box", "object_shape")
layer_namestring
Existing layer to create the object on (see list_layers). Default: the active layer. (min. 1 chars)
namestring
Object name (label), shown in InDesign's layers panel.

create_polygonCreate a polygon, star or free shape

Create a polygon (Polygon): either a regular polygon or star from bounds_mm with sides (3–100; a triangle is sides 3) and star_inset_percent (0 = regular polygon, greater than 0 = star with the inner points inset by that percentage), or a closed free shape from points_mm[] (3–200 anchor points {x, y} in page coordinates, straight segments; an arrow is a points_mm shape) – exactly one of the two ways. Colour, stroke, tint, gradient angle, text_wrap, layer_name and name as in create_ellipse. Returns frame_id, type "polygon", bounds_mm, sides and star_inset_percent (null for a free shape), point_count, points_mm[] read back from the path (anchor points only), fill and stroke as create_ellipse, landed_on_page_id, landed_on_page_name, swatch_ids. Note: text wrap by object shape follows the polygon outline. A timed-out call may still have created the object – check get_page_state before repeating.

Parameters (19)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
page_idintegerrequired
Page from list_pages or list_parent_pages.
bounds_mmobject
Position and size in mm from the top left corner of the page (or spread with coordinate_space "spread").
xnumberrequired
Left edge in mm; negative allowed for bleed (Anschnitt).
ynumberrequired
Top edge in mm; negative allowed.
widthnumberrequired
Width in mm, greater than 0. (> 0)
heightnumberrequired
Height in mm, greater than 0. (> 0)
sidesinteger
Number of sides for a regular polygon or points of a star (3–100). Needs bounds_mm. (≥ 3, ≤ 100)
star_inset_percentnumber
0 (default) = regular polygon; greater than 0 = star, inset of the inner points in percent. (≥ 0, ≤ 100)
points_mmarray of object
Anchor points of a closed free shape in mm (page coordinates), 3 to 200. Not together with bounds_mm/sides. (min. 3 items, max. 200 items)
items
xnumberrequired
ynumberrequired
coordinate_spacestring
Reference for x/y: "page" (default) is the top left corner of page_id, identical on left and right pages; "spread" is the top left corner of the spread (Druckbogen) – the right page of a spread starts at x = page width. (values: "page", "spread")
fill_hexstring
Fill colour as hex, e.g. "#E30613". Creates an RGB swatch.
fill_swatch_namestring
Exact name of an existing swatch for the fill – colour, tint or gradient swatch (see list_swatches). Not together with fill_hex. (min. 1 chars)
stroke_hexstring
Stroke colour as hex. Creates an RGB swatch.
stroke_swatch_namestring
Exact name of an existing swatch for the stroke (colour, tint or gradient). Not together with stroke_hex. (min. 1 chars)
stroke_weight_ptnumber
Stroke weight in points (1 pt with a warning when a stroke colour is given without it). (≥ 0)
fill_tint_percentnumber
Tint of the fill swatch in percent (0–100). (≥ 0, ≤ 100)
stroke_tint_percentnumber
Tint of the stroke swatch in percent (0–100). (≥ 0, ≤ 100)
gradient_fill_angle_degnumber
Angle of a linear gradient fill in degrees (-180 to 180); only visible with a gradient swatch as fill. (≥ -180, ≤ 180)
gradient_stroke_angle_degnumber
Angle of a linear gradient stroke in degrees (-180 to 180); only visible with a gradient swatch as stroke. (≥ -180, ≤ 180)
text_wrapstring
Text wrap of the new object: none, bounding_box or object_shape. Without it the document default applies – pass "none" when text lies underneath. (values: "none", "bounding_box", "object_shape")
layer_namestring
Existing layer to create the object on (see list_layers). Default: the active layer. (min. 1 chars)
namestring
Object name (label), shown in InDesign's layers panel.

create_lineCreate a line

Create a straight line on page_id from start_mm {x, y} to end_mm {x, y} (negative values allowed) with stroke_weight_pt (required, greater than 0, set in points – never in mm) and optional colour: swatch_name (exact name of an existing swatch, the right way for print – the document's CMYK swatches, see list_swatches) or stroke_hex (creates an RGB swatch); default Black. The line has no text wrap. Returns frame_id, page_id, start_mm, end_mm, stroke_weight_pt and stroke_color read back, swatch_ids, landed_on_page_id and landed_on_page_name. A timed-out call may still have created the line – check get_page_state before repeating.

Parameters (10)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
page_idintegerrequired
Page from list_pages or list_parent_pages.
start_mmobjectrequired
Start point in mm.
xnumberrequired
ynumberrequired
end_mmobjectrequired
End point in mm.
xnumberrequired
ynumberrequired
coordinate_spacestring
Reference for x/y: "page" (default) is the top left corner of page_id, identical on left and right pages; "spread" is the top left corner of the spread (Druckbogen) – the right page of a spread starts at x = page width. (values: "page", "spread")
stroke_hexstring
Stroke colour as hex (creates an RGB swatch). Default Black.
swatch_namestring
Exact name of an existing swatch for the stroke. Not together with stroke_hex. (min. 1 chars)
stroke_weight_ptnumberrequired
Stroke weight in points, greater than 0. (> 0)
stroke_tint_percentnumber
Tint of the stroke swatch in percent (0–100). (≥ 0, ≤ 100)
gradient_stroke_angle_degnumber
Angle of a linear gradient stroke in degrees; only visible with a gradient swatch. (≥ -180, ≤ 180)

duplicate_frameDuplicate an object

Duplicate a text frame, image frame, rectangle, line or group (as a whole, placed graphics included) and shift the copy by offset_mm {x, y}. The duplicate stays on the spread (Druckbogen) of the original – to put it on another page use move_frame_to_page. Returns source_frame_id, frame_id of the duplicate, type, bounds_mm, landed_on_page_id and landed_on_page_name; the change report lists new_frames. A timed-out call may still have duplicated – check get_page_state before repeating.

Parameters (3)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Object to duplicate, from get_page_state.
offset_mmobject
Shift of the copy in mm. Default {0, 0} = exactly on top of the original.
xnumberrequired
ynumberrequired

delete_frameDelete an object

Delete a text frame, image frame, rectangle, line or group (as a whole) by frame_id. A threaded text frame (verketteter Rahmen) takes its own text portion with it; the rest of the story stays in the other frames. There is no undo. Returns frame_id, type, was_threaded, characters_removed and removed_frame_ids (group members included).

Parameters (2)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Object to delete, from get_page_state.

clear_frame_contentRemove a placed graphic

Remove the placed graphic from a frame and keep the frame itself – position, size, stroke, corners, object style and stacking order stay, for recycled layouts. Text is left untouched (use set_text with "" for that). Returns frame_id and graphics_removed (0 when the frame was empty already), plus removed_link_names. No undo for the removed graphic; the link on disk is not deleted.

Parameters (2)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Frame to empty, from get_page_state.

group_framesGroup objects

Group two or more objects (text frames, graphic frames, rectangles, lines, groups) into one group (Gruppe). All objects must lie on the same spread (Druckbogen) and must not already be members of a group. Returns frame_id of the new group, member_ids, member_count, bounds_mm, landed_on_page_id and landed_on_page_name. The group is what get_page_state lists as type "group"; move it with move_frame_to_page, delete it with delete_frame, dissolve it with ungroup_frame. Members keep their ids and can still be read (get_frame_text, get_frame_options), but set_frame_bounds and move_frame_to_page work only on the group as a whole. A timed-out call may still have grouped – check get_page_state before repeating.

Parameters (2)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idsarray of integerrequired
Ids of the objects to group, at least two, all on the same spread. (min. 2 items, max. 500 items)

ungroup_frameUngroup a group

Dissolve a group (Gruppe aufheben): its members become independent objects of the page again and keep their ids; the group id disappears. Nested groups inside are kept as groups. Returns frame_id (the former group), member_ids, member_count, landed_on_page_id and landed_on_page_name of the members. Fails with invalid_state when the object is not a group or is itself inside a group (ungroup the outer group first).

Parameters (2)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Object id from get_page_state.

↑ Top

Changing frames and objects20 tools

get_frame_optionsOptions of a frameread-only

Read the options of an object as InDesign holds them: type (text, image, rectangle, ellipse, polygon, line, group, other), page_id/page_name (landing), bounds_mm, rotation_deg, text_wrap {mode, offset_mm}, appearance {fill_color, fill_kind, stroke_color, stroke_kind, stroke_weight_pt, fill_tint_percent, stroke_tint_percent, gradient_fill_angle_deg, gradient_stroke_angle_deg, gradient_fill_start_mm, gradient_fill_length_mm}, corners {top_left {type, radius_mm}, …, uniform} (null for lines and groups), effects {opacity_percent, blend_mode, drop_shadow, feather} of the object and has_effects {fill, stroke, text} (true where something deviates from normal / 100 %), parent_group_id, layer {layer_id, layer_name, visible, locked}, locked (Objekt > Sperren) and anchored {story_id, index, position} (null when the object is not anchored in text). For a text frame additionally text: columns {count, gutter_mm, type, fixed_width_mm}, inset_mm, vertical_justification, vertical_threshold_mm, first_baseline_offset (ascent, cap_height, leading, x_height, fixed, embox_top), min_first_baseline_pt, ignore_text_wrap, optical_margin_alignment and optical_margin_size_pt (story-wide, see set_story_options), threading {story_id, story_length, frame_index, frame_count, previous_frame_id, next_frame_id, overset, story_overset}, first_baseline_mm (baseline of the first line in mm from the top of the page – the direct check whether the first line sits on the baseline grid, if the layout uses one) and character_count. Read-only. Use it to copy the settings of an existing frame before rebuilding it with create_text_frame, set_frame_columns, set_frame_inset and set_text_wrap. Returns coordinate_space ("page" when the object lies on a page, "spread" on the pasteboard): bounds_mm is relative to page_id and can be passed back to set_frame_bounds together with page_id.

Parameters (2)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Object id from get_page_state.

set_frame_boundsMove or resize an object

Move or resize an existing text frame, image frame, rectangle or line without rebuilding it: bounds_mm {x, y, width, height}. With page_id the values are relative to that page (x/y may be negative for bleed); without page_id they are spread coordinates (Druckbogen). Never changes the spread. Groups are refused (their graphics would stay behind) – use move_frame_to_page. A rotated object takes the values in its rotated space; set set_frame_rotation 0 first. Resizing an image frame crops: the picture keeps its position and scale inside the frame, so a smaller frame shows less of it (the way to trim a bleed picture to the trim edge, or to crop a photo without rescaling) – use scale_image_in_frame or fit_frame when the picture should follow the new frame instead. Returns frame_id, bounds_mm as InDesign reports them, landed_on_page_id and landed_on_page_name; a landing on another page is a warning. Returns coordinate_space ("page" with page_id, otherwise "spread"); a page change without page_id is a warning, because page-relative values read elsewhere shift the object by one page width when passed as spread coordinates. When the object carries a text wrap, the document is recomposed afterwards and recomposed, overset_stories_before, overset_stories_after and overset_changed report whether the overset state of the document changed.

Parameters (4)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Object id from get_page_state.
bounds_mmobjectrequired
Position and size in mm from the top left corner of the page (or spread with coordinate_space "spread").
xnumberrequired
Left edge in mm; negative allowed for bleed (Anschnitt).
ynumberrequired
Top edge in mm; negative allowed.
widthnumberrequired
Width in mm, greater than 0. (> 0)
heightnumberrequired
Height in mm, greater than 0. (> 0)
page_idinteger
Page the coordinates refer to (same spread). Without it: spread coordinates.

move_frame_to_pageMove an object to another page

Move a text frame, image frame, rectangle, line or group to another page of the same document, keeping id, content, threading and links; graphics of a group travel with it (DOM move(), not bounds). position_mm {x, y} sets the top left corner relative to the new page; without it the object keeps the position it had on the old page. pasteboard {side, gap_mm, y_mm} puts the object on the pasteboard (Montagefläche) beside the spread of page_id instead: side left = left of the leftmost page of that spread, right = right of the rightmost page, gap_mm between object and page edge, y_mm the top edge relative to the page (default: as on the old page); not together with position_mm. The answer then carries on_pasteboard true and landed_on_page_id null; bounds_mm stay relative to page_id (negative x on the left side). Objects inside a group are refused. Returns frame_id, id_preserved (false only when InDesign needed duplicate-and-delete, then the id is new), landed_on_page_id, landed_on_page_name and bounds_mm. Careful: InDesign assigns an object to the page holding its centre – a half-page bleed object can stay on the neighbouring page (warning); then use set_frame_bounds without page_id. Rotated objects: set rotation 0 first. Returns coordinate_space "page"; when the object carries a text wrap the document is recomposed afterwards (recomposed, overset_stories_before, overset_stories_after, overset_changed).

Parameters (5)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Object id from get_page_state.
page_idintegerrequired
Target page from list_pages or list_parent_pages.
position_mmobject
Top left corner on the new page in mm. Default: same position as on the old page.
xnumberrequired
ynumberrequired
pasteboardobject
Put the object on the pasteboard (Montagefläche) beside the spread of page_id instead of on the page. Not together with position_mm.
sidestringrequired
Left of the leftmost or right of the rightmost page of the spread. (values: "left", "right")
gap_mmnumberrequired
Distance between object and page edge in mm. (≥ 0)
y_mmnumber
Top edge relative to the page in mm. Default: as on the old page.

set_frame_rotationRotate an object

Set the absolute rotation of an object in degrees (-360 to 360; positive = counterclockwise, as in InDesign; a portrait photo credit is -90; 0 straightens it). Rotates around the centre of the object. Returns frame_id, angle_deg read back and bounds_mm in the rotated space. Rule: draw frames unrotated, then rotate.

Parameters (3)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Object id from get_page_state.
angle_degnumberrequired
Absolute angle in degrees, positive counterclockwise. (≥ -360, ≤ 360)

set_frame_stackingChange stacking order

Change the stacking order (Stapelreihenfolge) of an object within its layer: bring_to_front, send_to_back, bring_forward or send_backward. Newly created objects always start on top. Returns frame_id and action.

Parameters (3)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Object id from get_page_state.
actionstringrequired
Stacking action within the layer. (values: "bring_to_front", "send_to_back", "bring_forward", "send_backward")

set_frame_appearanceFill and stroke of an object

Set fill, stroke colour and stroke weight of an object. fill and stroke take "#RRGGBB" (an RGB swatch is created or reused) or "none"; fill_swatch_name and stroke_swatch_name take the exact name of an existing colour, tint or gradient swatch instead (print: the document's CMYK swatches, see list_swatches, create_gradient_swatch) and each excludes the corresponding hex parameter. stroke_weight_pt is in points (0 or more). fill_tint_percent / stroke_tint_percent set the tint (0–100), gradient_fill_angle_deg / gradient_stroke_angle_deg the angle of a linear gradient (a warning when the swatch is no gradient). At least one parameter besides frame_id is required. Returns fill_kind and stroke_kind (none, color, tint, gradient, mixed_ink), the tints (null when none is set), the gradient angles and gradient_fill_start_mm / gradient_fill_length_mm as InDesign holds them. stroke "none" also sets the weight to 0, because [None] alone can resolve to black in localised documents – the reliable way to remove a stroke is stroke_weight_pt 0; check the export. Returns applied_fill, applied_stroke and applied_stroke_weight_pt read back from the object, plus swatch_ids of new swatches.

Parameters (11)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Object id from get_page_state.
fillstring
"#RRGGBB" or "none".
fill_swatch_namestring
Exact name of an existing swatch for the fill. Not together with fill. (min. 1 chars)
strokestring
"#RRGGBB" or "none" (also sets the weight to 0).
stroke_swatch_namestring
Exact name of an existing swatch for the stroke. Not together with stroke. (min. 1 chars)
stroke_weight_ptnumber
Stroke weight in points; 0 removes the stroke. (≥ 0)
fill_tint_percentnumber
Tint of the fill swatch in percent (0–100). (≥ 0, ≤ 100)
stroke_tint_percentnumber
Tint of the stroke swatch in percent (0–100). (≥ 0, ≤ 100)
gradient_fill_angle_degnumber
Angle of a linear gradient fill in degrees (-180 to 180); a warning when the fill is no gradient swatch. (≥ -180, ≤ 180)
gradient_stroke_angle_degnumber
Angle of a linear gradient stroke in degrees (-180 to 180); a warning when the stroke is no gradient swatch. (≥ -180, ≤ 180)

set_corner_optionsCorner options of a frame

Set the corner shape and size (Eckenoptionen) of a rectangle, text or graphic frame or polygon – per corner or for all four: corner_type none | rounded | inverse_rounded | bevel | inset | fancy plus radius_mm for all corners, or corners {top_left, top_right, bottom_left, bottom_right} each {type, radius_mm} – missing corners stay. At least one of them. type "none" resets the corner (the radius stays stored but has no effect). Lines and groups are refused (invalid_state). Corner options do not change bounds_mm, only the visible shape; text wrap by object shape follows the corner. Returns frame_id, type, corners {top_left {type, radius_mm}, …} read back, uniform (all four equal) and bounds_mm. get_frame_options shows the same under corners.

Parameters (5)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Object id from get_page_state.
corner_typestring
Corner shape for all four corners. (values: "none", "rounded", "inverse_rounded", "bevel", "inset", "fancy")
radius_mmnumber
Corner radius in mm for all four corners. (≥ 0)
cornersobject
Per-corner settings; corners that are left out keep their values.
top_leftobject
typestring
(values: "none", "rounded", "inverse_rounded", "bevel", "inset", "fancy")
radius_mmnumber
(≥ 0)
top_rightobject
typestring
(values: "none", "rounded", "inverse_rounded", "bevel", "inset", "fancy")
radius_mmnumber
(≥ 0)
bottom_leftobject
typestring
(values: "none", "rounded", "inverse_rounded", "bevel", "inset", "fancy")
radius_mmnumber
(≥ 0)
bottom_rightobject
typestring
(values: "none", "rounded", "inverse_rounded", "bevel", "inset", "fancy")
radius_mmnumber
(≥ 0)

set_frame_effectsEffects: opacity, blend mode, drop shadow, feather

Set InDesign effects (Effekte) of an object for target object (default), fill, stroke or text (text only on text frames): opacity_percent (0–100), blend_mode (normal, multiply, screen, overlay, soft_light, hard_light, color_dodge, color_burn, darken, lighten, difference, exclusion, hue, saturation, color, luminosity), drop_shadow {enabled (required), opacity_percent, angle_deg, distance_mm, size_mm (0–50.08), spread_percent, noise_percent, color {swatch_name | hex}, blend_mode, use_global_light, knocked_out, honor_other_effects – omitted values keep InDesign's own defaults} and feather {enabled (required), width_mm (0–352.78), corner_type sharp | rounded | diffused, noise_percent, choke_percent}. At least one of them; unknown keys are refused (inner/outer glow, bevel, satin, directional and gradient feather are not in this version). Returns frame_id, type, target, effects {opacity_percent, blend_mode, drop_shadow {…, x_offset_mm, y_offset_mm}, feather {…}} read back and changed[]. opacity_percent 100, blend_mode normal, drop_shadow.enabled false and feather.enabled false restore the plain state. Pitfalls: every effect brings transparency into the document – a PDF/X-1a preset flattens it on export, PDF/X-4 keeps it (check preflight_document and export_pdf); blend modes look different in RGB and CMYK documents; a shadow on a group acts on the group as a whole. get_frame_options shows effects (object) and has_effects {fill, stroke, text}.

Parameters (7)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Object id from get_page_state.
targetstring
Which part the effects apply to. Default object. (values: "object", "fill", "stroke", "text")
opacity_percentnumber
Opacity (Deckkraft) 0–100. (≥ 0, ≤ 100)
blend_modestring
Blend mode (Mischmodus). (values: "normal", "multiply", "screen", "overlay", "soft_light", "hard_light", "color_dodge", "color_burn", "darken", "lighten", "difference", "exclusion", "hue", "saturation", "color", "luminosity")
drop_shadowobject
Drop shadow (Schlagschatten). Omitted values keep InDesign's defaults.
enabledbooleanrequired
Switch the drop shadow on or off.
opacity_percentnumber
(≥ 0, ≤ 100)
angle_degnumber
(≥ -360, ≤ 360)
distance_mmnumber
(≥ 0, ≤ 352.778)
size_mmnumber
Blur size (Größe). (≥ 0, ≤ 50.08)
spread_percentnumber
(≥ 0, ≤ 100)
noise_percentnumber
(≥ 0, ≤ 100)
colorobject
Shadow colour: an existing swatch by name or a hex value.
swatch_namestring
(min. 1 chars)
hexstring
blend_modestring
(values: "normal", "multiply", "screen", "overlay", "soft_light", "hard_light", "color_dodge", "color_burn", "darken", "lighten", "difference", "exclusion", "hue", "saturation", "color", "luminosity")
use_global_lightboolean
knocked_outboolean
honor_other_effectsboolean
featherobject
Basic feather (weiche Kante).
enabledbooleanrequired
Switch the basic feather on or off.
width_mmnumber
(≥ 0, ≤ 352.78)
corner_typestring
(values: "sharp", "rounded", "diffused")
noise_percentnumber
(≥ 0, ≤ 100)
choke_percentnumber
(≥ 0, ≤ 100)

set_frame_columnsColumns inside a text frame

Set the number of columns inside a text frame (not the page grid): count (1 or more; the parameter is count, not column_count) and gutter_mm (Spaltenabstand; without it the frame keeps its current gutter – InDesign's own default for new frames is 1 pica = 4.233 mm). Returns frame_id, count and gutter_mm read back. Fails with invalid_state for anything but a text frame.

Parameters (4)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Object id from get_page_state.
countintegerrequired
Number of columns inside the frame. (≥ 1)
gutter_mmnumber
Gutter between the columns in mm. Without it the current gutter of the frame stays. (≥ 0)

set_frame_insetInset of a text frame

Set the inset spacing (Innenabstand) of a text frame: inset_mm {top, left, bottom, right}, all four required, 0 or more; and/or the vertical justification (vertikale Ausrichtung, Textrahmenoptionen): vertical_justification top, center, bottom or justify. At least one of the two; what is omitted stays. Returns frame_id, inset_mm and vertical_justification read back (get_frame_options reads both under text).

Parameters (4)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Object id from get_page_state.
inset_mmobject
Inset in mm: { top, left, bottom, right }, all required. Optional when vertical_justification is given.
topnumberrequired
(≥ 0)
leftnumberrequired
(≥ 0)
bottomnumberrequired
(≥ 0)
rightnumberrequired
(≥ 0)
vertical_justificationstring
Vertical justification of the text in the frame (vertikale Ausrichtung). Without it the frame keeps its setting. (values: "top", "center", "bottom", "justify")

set_text_wrapText wrap of an object

Set the text wrap (Textumfluss) of an object: mode none, bounding_box, object_shape, jump_object or next_column, with an optional offset as offset_mm or offset_pt {top, left, bottom, right} (one of them, not both; object_shape uses only one distance). The reliable cure for text frames pushed into overset by a new frame is mode "none". Returns frame_id, mode and offset_mm read back. The document is recomposed afterwards; recomposed, overset_stories_before, overset_stories_after and overset_changed report whether the overset state of the document changed.

Parameters (5)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Object id from get_page_state.
modestringrequired
Text wrap mode. (values: "none", "bounding_box", "object_shape", "jump_object", "next_column")
offset_mmobject
Wrap offset in mm.
topnumberrequired
(≥ 0)
leftnumberrequired
(≥ 0)
bottomnumberrequired
(≥ 0)
rightnumberrequired
(≥ 0)
offset_ptobject
Wrap offset in points.
topnumberrequired
(≥ 0)
leftnumberrequired
(≥ 0)
bottomnumberrequired
(≥ 0)
rightnumberrequired
(≥ 0)

thread_text_framesThread two text frames

Thread (verketten) two text frames into one story: the text of source_frame_id continues in target_frame_id. Already threaded to each other = no-op (already_threaded true). Text already in the target is merged into the story after the source text (warning). A source that already continues elsewhere, or a target that already continues another frame, is refused with invalid_state. Returns source_frame_id, target_frame_id, story_id and story_character_count.

Parameters (3)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
source_frame_idintegerrequired
Frame whose text continues in the target.
target_frame_idintegerrequired
Frame that receives the continuation.

fit_frameFit frame or content

InDesign's fitting commands (Anpassen) as one call. For a graphic frame: content_to_frame (distorts), fit_proportionally (whole picture visible, may leave space), fill_proportionally (frame filled, picture cropped), center_content, or frame_to_content (the frame takes the size of the picture, top left corner stays). For a text frame only frame_to_content: the frame shrinks or grows to its text (Rahmen an Inhalt anpassen) – InDesign fits width and height (the width to the longest line); keep_width true fits the height only and keeps the width (via auto-size height only, reference top left) – the usual choice for headlines and captions; if the layout uses a baseline grid, check the result against it. Returns frame_bounds_before_mm, frame_bounds_mm, frame_changed, and for pictures graphic_bounds_mm, fits_frame and effective_ppi (warning below min_ppi), for text overset. Fails on groups, lines, empty graphic frames and members of a group. Returns coordinate_space ("page", or "spread" on the pasteboard); when the object carries a text wrap the document is recomposed afterwards (recomposed, overset_stories_before, overset_stories_after, overset_changed).

Parameters (5)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Object id from get_page_state.
modestringrequired
Which fitting to apply. (values: "frame_to_content", "content_to_frame", "fit_proportionally", "fill_proportionally", "center_content")
keep_widthboolean
Text frames, frame_to_content: fit the height only and keep the width. Default false = InDesign behaviour (width and height).
min_ppinumber
Effective resolution in ppi below which a warning is given. Default: the configured value, otherwise 300 (the usual offset print value: twice the 150 lpi screen). (> 0)

align_objectsAlign or distribute objects

Align (mode align) or distribute (mode distribute) several objects on one spread like the Align panel (Ausrichten): edge left, horizontal_center, right, top, vertical_center, bottom – for distribute also horizontal_space and vertical_space (equal gaps; with spacing_mm a fixed gap). relative_to selection (default: the objects' common bounds), key_object (with key_frame_id, the key stays put), margins, page or spread. Groups move as a whole; members of a group, objects on other spreads and locked layers are refused. Returns objects[] {frame_id, bounds_mm} after, before, moved_count (warning when nothing moved). All coordinates are page millimetres of the page each object lands on.

Parameters (7)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idsarray of integerrequired
Objects to align or distribute (2 or more; 1 is enough when aligning to margins, page or spread). (min. 1 items, max. 500 items)
modestring
align (default) or distribute. (values: "align", "distribute")
edgestringrequired
Which edges or centres; *_space only for distribute. (values: "left", "horizontal_center", "right", "top", "vertical_center", "bottom", "horizontal_space", "vertical_space")
relative_tostring
Reference bounds. Default selection. (values: "selection", "key_object", "margins", "page", "spread")
key_frame_idinteger
relative_to key_object: the object that stays in place (one of frame_ids).
spacing_mmnumber
distribute: fixed distance in mm instead of equal distribution.

anchor_frame_in_textAnchor object in text

Anchor a frame, picture, line or group at a text position (verankertes Objekt) so it moves with the text on reflow: target_frame_id names a frame of the story, index the character position (default: end of the story), position inline (on the baseline), above_line, or custom with offset_mm {x, y}, anchor_point, horizontal_reference (anchor_location, column_edge, text_frame, page_margins, page_edge), vertical_reference (line_baseline, line_xheight, line_ascent, cap_height, top_of_leading, embox_top, embox_middle, embox_bottom, column_edge, text_frame, page_margins, page_edge), horizontal_alignment (left, center, right, text), vertical_alignment (top, center, bottom), keep_within_frame, lock_position. The object leaves its page and becomes part of the story (an U+FFFC character at index). Returns frame_id (read back; a new id is warned), story_id, index, story_length, settings, bounds_mm, page_id and story_overset (warning). Fails on group members, already anchored objects, a frame of the target story, locked layers. An anchored object leaves its place on the page and follows the text on reflow – anchor deliberately (captions, marginalia, inline symbols) and leave objects that must keep their position unanchored.

Parameters (13)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Object id from get_page_state.
target_frame_idintegerrequired
A text frame of the story to anchor into.
indexinteger
Character index in the story (0 = before the first character). Default: end of the story. (≥ 0)
positionstring
inline (default), above_line or custom. (values: "inline", "above_line", "custom")
offset_mmobject
custom only: offset in mm (x right, y down).
xnumber
ynumber
anchor_pointstring
custom only: reference point on the object. (values: "top_left", "top_center", "top_right", "left_center", "center", "right_center", "bottom_left", "bottom_center", "bottom_right")
horizontal_referencestring
custom only. (values: "anchor_location", "column_edge", "text_frame", "page_margins", "page_edge")
vertical_referencestring
custom only. (values: "line_baseline", "line_xheight", "line_ascent", "cap_height", "top_of_leading", "embox_top", "embox_middle", "embox_bottom", "column_edge", "text_frame", "page_margins", "page_edge")
horizontal_alignmentstring
custom only. (values: "left", "center", "right", "text")
vertical_alignmentstring
custom only. (values: "top", "center", "bottom")
keep_within_frameboolean
custom only: keep the object within the top and bottom of the text frame (pin position).
lock_positionboolean
custom only: prevent manual dragging.

unanchor_frameRelease anchored object

Release an anchored object from its text: it stays where it is drawn but becomes a free object of the page again (the anchor character is removed from the story). Returns frame_id (read back), was_anchored {story_id, index, position}, bounds_mm, page_id/page_name. invalid_state when the object is not anchored.

Parameters (2)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Object id from get_page_state.

list_object_stylesList object stylesread-only

List the object styles (Objektformate) of the document: styles[] {style_id, name, group_path, based_on, built_in ([None], [Basic Graphics Frame], [Basic Text Frame] – localized names in a German InDesign), applies {fill, stroke, stroke_and_corner, transform, text_frame_general, text_frame_baseline, text_frame_auto_sizing, paragraph_style, story_options, text_wrap_and_others, anchored_object, frame_fitting} (which categories the style sets), fill_color, stroke_color, stroke_weight_pt, paragraph_style, and – each only when the style sets that category, otherwise null – fill_tint_percent, overprint_fill, stroke_tint_percent, stroke_type, corners {top_left {type, radius_mm} … uniform}, text_frame {columns, inset_mm, vertical_justification, vertical_threshold_mm, first_baseline_offset, min_first_baseline_pt, ignore_text_wrap}, text_wrap {mode, offset_mm}, effects (opacity, blend mode, drop shadow, feather), anchored, frame_fitting {on_empty_frame, auto_fit, crop_mm}, story {optical_margin_alignment, optical_margin_size_pt}}, count. include_built_in false hides the bracketed defaults. Read-only. Use the exact names with apply_object_style.

Parameters (2)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
include_built_inboolean
Also list the bracketed default styles. Default true.

apply_object_styleApply an object style

Apply an object style (Objektformat) to a frame, line or group by exact name; clear_overrides true (default) removes local overrides of the categories the style sets. Unknown names are not_found with the available names in the details. Returns style_name (read back), style_id, previous_style_name, changed, bounds_mm and bounds_changed (auto-size or fitting options can move the frame), appearance {fill_color, stroke_color, stroke_weight_pt} and overset for text frames (warning). Fails with invalid_state on locked layers and locked objects.

Parameters (4)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Object id from get_page_state.
style_namestringrequired
Object style name, exact, as list_object_styles returns it. (min. 1 chars)
clear_overridesboolean
Clear local overrides while applying. Default true.

get_selectionRead the selectionread-only

What is selected in the document window right now: items[] {frame_id, type, class_name, page_id, page_name, on_parent_page, bounds_mm, layer_name, parent_group_id}, frame_ids, text {story_id, start_index, end_index, length, frame_id, text} when text or an insertion point is selected, other[] (class names of anything else), count, is_active_document (the selection belongs to the active window; other documents report empty). Read-only. The natural hand-over when the user points at something in InDesign and wants you to continue with it. Each item carries coordinate_space ("page" or "spread") for its bounds_mm.

Parameters (1)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.

set_selectionSelect objects

Select objects in the document window by frame_ids (replaces the selection) – to show the user what you mean – or a text range with text_range {frame_id, start_index, end_index} (story indices as get_frame_text gives them; start_index equal to end_index places the insertion point there), or clear true to deselect everything. Selecting text switches InDesign to the text tool at that place; combine with show_page to make it visible. Objects on hidden or locked layers cannot be selected (warning when fewer objects end up selected). Returns the selection as get_selection does plus cleared (and story_length for a text range).

Parameters (4)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idsarray of integer
Objects to select. (min. 1 items, max. 500 items)
text_rangeobject
Text to select instead of objects.
frame_idintegerrequired
Object id from get_page_state.
start_indexintegerrequired
First character (inclusive), story index. (≥ 0)
end_indexintegerrequired
End (exclusive); equal to start_index for an insertion point. (≥ 0)
clearboolean
Deselect everything instead.

↑ Top

Images and links9 tools

place_imagePlace an image or PDF

Place an image or PDF file (real path on the InDesign machine) into a graphic frame, replacing whatever it held (crop and scale are reset – to merely swap the file use relink_links). fit: fill_proportionally, fit_proportionally, fit_content_to_frame or center_content; without it the frame fitting options of the frame apply. pdf_crop chooses the PDF page box: media (InDesign default – the whole sheet including printer marks, the usual reason for misplaced ads), crop, trim, bleed (for bleed ads), art or content; pdf_page picks the page (default 1). When the PDF has no such box (a QR code PDF without TrimBox, say), InDesign refuses – the tool then falls back to the next larger box (bleed → trim → crop → media) with a warning and reports pdf_crop_used; pdf_crop_fallback false turns that off and returns the io_error instead. The place preferences are set for this call only and restored. Returns frame_id, link_status, frame_bounds_mm, graphic_bounds_mm, pdf_crop_used and fits_frame (true when the graphic covers the frame within 0.2 mm; otherwise a warning); a warning when the effective resolution is below min_ppi. A changed CropBox of a PDF is ignored by InDesign; for asymmetric bleed derive a placement copy of the PDF. A timed-out call may still have placed – check get_image_link_info before repeating.

Parameters (8)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Object id from get_page_state.
image_pathstringrequired
Real file path of the image or PDF on the machine running InDesign. (min. 1 chars)
fitstring
Fitting after placing. (values: "fill_proportionally", "fit_proportionally", "fit_content_to_frame", "center_content")
pdf_cropstring
PDF page box to import. InDesign default media. (values: "media", "crop", "trim", "bleed", "art", "content")
pdf_pageinteger
Page of a multi-page PDF. Default 1. (≥ 1)
pdf_crop_fallbackboolean
Fall back to the next larger PDF box with a warning when the requested box is missing. Default true.
min_ppinumber
Effective resolution in ppi below which a warning is given. Default: the configured value, otherwise 300 (the usual offset print value: twice the 150 lpi screen). (> 0)

scale_image_in_frameScale a placed graphic

Scale the graphic inside a frame by zoom_factor (greater than 0; 1.2 = 20 % larger) around an anchor of the frame (center, top, bottom, left, right, top_left, top_right, bottom_left, bottom_right; default center). Frame and crop stay. Returns graphic_bounds_mm, frame_bounds_mm and effective_ppi after the zoom (warning below min_ppi; PDFs report none).

Parameters (5)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Object id from get_page_state.
zoom_factornumberrequired
Scale factor, e.g. 1.2 for 20 % larger, 0.9 for 10 % smaller. (> 0)
anchorstring
Anchor of the frame that stays fixed. Default center. (values: "center", "top", "bottom", "left", "right", "top_left", "top_right", "bottom_left", "bottom_right")
min_ppinumber
Effective resolution in ppi below which a warning is given. Default: the configured value, otherwise 300 (the usual offset print value: twice the 150 lpi screen). (> 0)

position_image_in_framePosition a placed graphic

Move the graphic inside a frame without scaling it; the frame stays as it is (frame bounds, crop edges and page). align puts the graphic's reference point onto the same reference point of the frame (center, top, bottom, left, right, top_left, top_right, bottom_left, bottom_right – e.g. top_left: upper left corners meet, center: centred); offset_mm {x, y} then shifts it by x/y mm (positive = right/down). Pass align, offset_mm or both. Returns frame_id, graphic_id, align, offset_mm, moved_by_mm {x, y}, graphic_bounds_mm, graphic_bounds_before_mm and frame_bounds_mm (relative to page_id, coordinate_space "page"; "spread" on the pasteboard) and fits_frame – a warning when the graphic no longer covers the frame. To change the size use scale_image_in_frame or fit_frame.

Parameters (4)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Object id from get_page_state.
alignstring
Reference point of graphic and frame that are brought together (one of nine). (values: "center", "top", "bottom", "left", "right", "top_left", "top_right", "bottom_left", "bottom_right")
offset_mmobject
Shift in mm after align (or from the current position): positive x to the right, positive y down.
xnumberrequired
ynumberrequired

↑ Top

Reading and writing text12 tools

get_frame_textRead the text of a frameread-only

Read the story of a text frame: story_id, story_length, paragraphs[] {index, start_index, end_index (exclusive, without the break), end_index_incl_break, paragraph_style, text, is_empty, break_type (paragraph, column, frame, page, odd_page, even_page or none for the last paragraph)} and overset for this frame. Column breaks count like paragraph marks; zero-width characters (U+FEFF) are returned as they are. For a threaded frame the whole story is returned, with frame_start_index and frame_end_index marking this frame's portion – pass only_frame_portion true to get only the paragraphs in this frame (text clipped at the frame boundaries, clipped_start/clipped_end mark the cut), and max_chars to cap the text returned (truncated true, paragraphs_omitted counts the rest). Indices always refer to the whole story, so they can be used with set_text_in_range and the *_to_range tools. Read-only. There is no include_overset parameter.

Parameters (5)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Object id from get_page_state.
only_frame_portionboolean
true: only the paragraphs shown in this frame, text clipped at its boundaries. Default false = whole story.
max_charsinteger
Budget for the text returned across all paragraphs; the rest is counted in paragraphs_omitted. (≥ 1)
show_placeholdersboolean
Show special characters in text as {{…}} placeholders (line_break, nbsp, nbsp_fixed, thin_space, hair_space, soft_hyphen, nb_hyphen, en_dash, em_dash, tab, column_break, frame_break, page_break). Default false. Indices stay story-wide; each placeholder stands for one character.

set_textReplace the text of a frame

Replace the whole story of a text frame (really replace, never append): text with real line breaks as paragraph marks ("\n" or "\r\n" in the parameter become paragraph returns; U+2028 stays a forced line break). "" empties the frame. The text takes the document text defaults as local formatting – apply a paragraph style afterwards with apply_paragraph_style_to_range over the whole story. For a threaded frame the entire story across all frames is replaced (warning). Returns frame_id, character_count read back and overset. Placeholders in the text become InDesign special characters (placeholders true, default): {{line_break}} (forced line break within the paragraph), {{nbsp}} (no-break space U+00A0), {{nbsp_fixed}} (fixed-width no-break space U+202F), {{thin_space}}, {{hair_space}}, {{soft_hyphen}} (discretionary hyphen), {{nb_hyphen}} (no-break hyphen), {{en_dash}}, {{em_dash}}, {{tab}}, {{column_break}}, {{frame_break}}, {{page_break}}. Unknown {{…}} stay as written with a warning; each placeholder is exactly one character in the story. Returns placeholders_replaced {name: count} and placeholders_unknown[].

Parameters (4)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Object id from get_page_state.
textstringrequired
New text; line breaks become paragraph marks, {{line_break}} a forced line break; "" empties the frame.
placeholdersboolean
Expand {{…}} placeholders into special characters. Default true; false writes them literally.

set_text_in_rangeReplace a character range

Replace characters start_index (inclusive) to end_index (exclusive) of the story of a text frame with text; start == end inserts, text "" deletes the range. The new text keeps the formatting of the first replaced character up to its first paragraph mark (keep_format_of "start", default) – also when the range begins a paragraph that follows a paragraph with other formatting; every further new paragraph takes the formatting and paragraph style of the replaced paragraph at the same position (beyond the last one: of the last replaced paragraph). If the range begins with a paragraph mark, the paragraphs merge and the new text continues that paragraph in its formatting. The right way for formatted placeholders and for a full swap (0 to story_length). keep_format_of "before" leaves the choice to InDesign (the range is replaced in one step); "none" removes character style and local character formatting from the new text, so it shows its paragraph style. An insertion (start == end) takes InDesign's formatting of the insertion point unless keep_format_of is "none". An empty line is two line breaks. Indexes come from get_frame_text. Returns frame_id, replaced_chars, inserted_chars, story_length and keep_format_of. Placeholders in the text become InDesign special characters (placeholders true, default): {{line_break}} (forced line break within the paragraph), {{nbsp}} (no-break space U+00A0), {{nbsp_fixed}} (fixed-width no-break space U+202F), {{thin_space}}, {{hair_space}}, {{soft_hyphen}} (discretionary hyphen), {{nb_hyphen}} (no-break hyphen), {{en_dash}}, {{em_dash}}, {{tab}}, {{column_break}}, {{frame_break}}, {{page_break}}. Unknown {{…}} stay as written with a warning; each placeholder is exactly one character in the story. Returns placeholders_replaced {name: count} and placeholders_unknown[].

Parameters (7)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Object id from get_page_state.
start_indexintegerrequired
First character to replace (inclusive). (≥ 0)
end_indexintegerrequired
End of the range (exclusive); equal to start_index inserts. (≥ 0)
textstringrequired
Replacement text; "" deletes. Placeholders such as {{nbsp}} are expanded.
placeholdersboolean
Expand {{…}} placeholders into special characters. Default true; false writes them literally.
keep_format_ofstring
Formatting of the new text: "start" (default) the first replaced character up to the first new paragraph mark, then paragraph by paragraph the replaced paragraph at the same position; "before" whatever InDesign chooses; "none" the paragraph style without character style or local character formatting. (values: "start", "before", "none")

find_replaceFind and replace text

Find and replace text in the document or in one frame: find, replace, mode literal or grep (default literal), scope document or frame (frame needs frame_id), include_master_pages, include_hidden_layers, include_locked_layers (all default false), case_sensitive and whole_word (default false). dry_run true only counts and lists up to 200 matches with frame_id, page_name and index – use it before any name replacement. GREP metacharacters: ~M column break, ~R frame break, ~P page break, ~S non-breaking space (a literal U+00A0 is not found in literal mode); a straight " in GREP matches every quote, including typographic ones. Returns replacements, matches_found, scope, mode and master_pages_included. No undo.

Parameters (12)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
findstringrequired
Text or GREP pattern to find. (min. 1 chars)
replacestring
Replacement text; required unless dry_run is true. "" deletes the matches.
modestring
literal (default) or grep. (values: "literal", "grep")
scopestring
document (default) or frame (needs frame_id). (values: "document", "frame")
frame_idinteger
Frame for scope "frame".
include_master_pagesboolean
Also search master pages. Default false.
include_hidden_layersboolean
Also search hidden layers. Default false.
include_locked_layersboolean
Also search locked layers and stories. Default false.
case_sensitiveboolean
Literal mode: match case. Default false.
whole_wordboolean
Literal mode: whole words only. Default false.
dry_runboolean
true: count and list matches, change nothing.

place_text_filePlace a text file

Place a manuscript file (.docx, .doc, .rtf or .txt on the InDesign machine) into a text frame – the cheap way for long articles instead of passing the text as a string. mode replace (default) empties the story first; append adds at the end of the story. retain_formatting false (default) imports plain text (Word styles and local formatting removed) so that paragraph_style (applied to every placed paragraph, like apply_paragraph_style_to_range) gives the document's paragraph style; retain_formatting true keeps Word styles and local formatting and imports the Word paragraph styles (names that already exist in the document are used as they are). style_map {"Word style": "document style"} maps Word paragraph styles to existing document styles after the import (forces retain_formatting true) and removes the mapped Word styles again (styles_removed); every target style must exist. typographers_quotes (default true) converts straight quotes. Footnotes and endnotes are imported, tables come in as InDesign tables, graphics, index and table of contents are not imported. Returns placed_start_index, placed_end_index and inserted_chars (story indices for the *_to_range tools), story_length, paragraph_count, styles_added (paragraph styles the import created – remove or map them), styles_mapped and overset of the story. autoflow true (Sitzung 8) keeps adding pages after the page of the last frame – same parent page, a frame with the bounds and frame options of the last one (columns, gutter, insets, vertical justification, first baseline – copied value by value), threaded – until the text fits or max_pages (default 20) is reached; the result carries autoflow {pages_added, frames_added[] {frame_id, page_id, bounds_mm, frame_options_copied, frame_options_failed[], frame_options_skipped[] (values that do not apply, e.g. vertical_threshold without vertical justify), columns {count, gutter_mm}}, overset, stopped}. Without autoflow, thread frames with thread_text_frames. Autoflow keeps the layout window where it was (keep_view, default true; view_restored in the answer) – pass keep_view false to follow the new pages. A timed-out call may still have placed – check get_frame_text before repeating.

Parameters (11)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Object id from get_page_state.
file_pathstringrequired
Real path of the .docx, .doc, .rtf or .txt file on the machine running InDesign. (min. 1 chars)
modestring
replace (default): empty the story first; append: add at the end of the story. (values: "replace", "append")
retain_formattingboolean
true keeps Word styles and local formatting. Default false = plain text.
paragraph_stylestring
Existing paragraph style applied to every placed paragraph. (min. 1 chars)
style_mapobject
Word paragraph style name → existing document style name; applied after the import.
typographers_quotesboolean
Convert straight quotes to typographic ones. Default true.
autoflowboolean
Add pages and threaded frames until the text fits. Default false.
max_pagesinteger
autoflow: at most this many pages. Default 20. (≥ 1, ≤ 200)
keep_viewboolean
Restore the previous view (page and zoom of the layout window) afterwards – InDesign otherwise jumps to the new page. Default true; false lets the view move. The answer carries view_restored (null when the document has no window).

list_storiesList storiesread-only

Overview of the stories (Textabschnitte) of the document: which frames belong to which story and in what order, and which story overflows. stories[] {story_id, frame_ids (chain order), frame_count, frames[] {frame_id, index, page_id, page_name, on_pasteboard, on_parent_page, bounds_mm}, character_count, paragraph_count, table_count, overset, on_parent_page, first_page_id, first_page_name, first_paragraph_style, snippet}, count, total_stories, overset_count (warning when above 0). Stories on parent pages are skipped unless include_parent_pages true; empty stories are listed unless include_empty false; page_id keeps only stories with a frame on that page. Read-only. get_frame_text reads one story; thread_text_frames changes the chain.

Parameters (5)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
page_idinteger
Only stories that have a frame on this page.
include_parent_pagesboolean
Also list stories on parent (master) pages. Default false.
include_emptyboolean
List stories without text. Default true.
snippet_charsinteger
Length of the text snippet per story. Default 80. (≥ 0, ≤ 2000)

get_frame_linesLines of a text frame (composition)read-only

Read the composed lines of a text frame directly from InDesign, per text column – the basis for widow/orphan checks (Hurenkind, Schusterjunge), hyphen ladders, empty lines and the comparison of column starts, without a PDF export. Returns frame_id, story_id, frame_index (position of the frame in the story), page_id, column_count, line_count, columns[] {column_index, bounds_mm (from frame, inset, column count and gutter), line_count, first_baseline_mm, last_baseline_mm (mm from the top of the page), starts_with_last_line_of_paragraph (widow suspicion), ends_with_first_line_of_paragraph (orphan suspicion), starts_with_empty_line, consecutive_hyphens_max, ends_with_single_word, single_word_last_lines[], lines[] {index (in the column), start_index, end_index (story indices, end exclusive – usable in the *_to_range tools), baseline_mm, ascent_pt, descent_pt, left_mm, right_mm, paragraph_index (0-based in the story), is_first_line_of_paragraph, is_last_line_of_paragraph, paragraph_line_count (story-wide, so a paragraph continuing in the next frame is still counted whole), ends_with_hyphen, is_empty, word_count, last_char, text (only with include_text)}}, overset and truncated. Pitfalls: only composed text has lines – overset text has none; an automatic hyphen is not part of the text, so ends_with_hyphen is inferred when a line ends and the next line of the same paragraph begins with a letter; the last line of a paragraph that continues in the next frame is the last visible line here, not the last line of the paragraph (compare paragraph_line_count); lines inside tables are not Line objects and are not listed. Read-only. Returns coordinate_space ("page" or "spread") for the coordinates reported.

Parameters (4)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Object id from get_page_state.
include_textboolean
Also return the text of every line. Default false (figures only).
max_linesinteger
Cap for the lines returned over all columns. Default 500. (≥ 1, ≤ 5000)

set_story_optionsStory options (optical margin alignment)

Read or set story-wide options of the story a text frame belongs to (frame_id names any frame of the story): optical_margin_alignment (optischer Randausgleich / hängende Interpunktion – punctuation and letter edges hang slightly outside the column edge, which makes justified edges look straight) and optical_margin_size_pt (the point size the alignment is calculated for; usually the body text size, 0.1–1296). Without parameters it is read-only. Returns story_id, frame_ids[] of the story in threading order, the two values after the change, previous {…}, changed[] and overset of the story. Optical margin alignment recomposes every line of the story – check get_frame_lines afterwards. get_frame_options shows the two values under text as well.

Parameters (4)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Object id from get_page_state.
optical_margin_alignmentboolean
Switch optical margin alignment on or off for the whole story.
optical_margin_size_ptnumber
Reference point size for the alignment, usually the body text size. (≥ 0.1, ≤ 1296)

list_text_variablesList text variablesread-only

List the text variables (Textvariablen) of the document: variables[] {name, type (custom_text, running_header_paragraph, running_header_character, file_name, output_date, creation_date, modification_date, last_page_number, chapter_number, or the raw type), options per type (text; paragraph_style/character_style, use first|last, text_before, text_after, delete_end_punctuation; include_extension, include_path; format), instance_count (instances in the stories)}, count. Read-only. Every document carries InDesign's default variables.

Parameters (1)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.

create_text_variableCreate or update a text variable

Create a text variable (Textvariable) or update the options of an existing one with the same name and type: type custom_text (text), running_header_paragraph (paragraph_style, use first|last, text_before, text_after, delete_end_punctuation), running_header_character (character_style, …), file_name (include_extension, include_path, text_before, text_after), output_date/creation_date/modification_date (date_format, text_before, text_after), last_page_number, chapter_number. remove true deletes the variable (and its instances in the text – warning). A running header from the headline style is the classic use on parent pages: create the variable, then insert_text_variable into a frame on the parent page.

Parameters (14)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
namestringrequired
Name of the text variable, exact. (min. 1 chars)
typestring
Variable type; required unless remove. (values: "custom_text", "running_header_paragraph", "running_header_character", "file_name", "output_date", "creation_date", "modification_date", "last_page_number", "chapter_number")
textstring
custom_text: the text.
paragraph_stylestring
running_header_paragraph: paragraph style to pick the text from. (min. 1 chars)
character_stylestring
running_header_character: character style to pick the text from. (min. 1 chars)
usestring
Running headers: first or last occurrence on the page. Default first. (values: "first", "last")
text_beforestring
Text before the value.
text_afterstring
Text after the value.
delete_end_punctuationboolean
Running headers: drop end punctuation.
include_extensionboolean
file_name: include the extension.
include_pathboolean
file_name: include the folder path.
date_formatstring
Date variables: format string as in InDesign (e.g. dd.MM.yyyy).
removeboolean
Delete the variable named name.

insert_text_variableInsert a text variable

Insert an instance of a text variable at a text position: frame_id (a frame of the story, also on a parent page), name, index (default: end of the story). Returns instance_id, story_id, frame_id, index, result_text (what the variable shows there), story_length, overset. The instance counts as one character in the story.

Parameters (4)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Object id from get_page_state.
namestringrequired
Name of the text variable, exact. (min. 1 chars)
indexinteger
Character index in the story. Default: end. (≥ 0)

convert_text_to_outlinesConvert text to outlines (irreversible)

Convert the text of a text frame into paths (in Pfade umwandeln) – a headline as a graphic, independent of installed fonts. Irreversible: there is no undo through this interface; confirm true is required. delete_original true (default) replaces the frame with the outlines; false keeps the text frame and puts the outlines on top of it. Refused (invalid_state): empty frames, threaded frames (the story runs over more than one frame), frames with overset text, frames on locked layers. Tables inside the frame give a warning – check the result. Returns frame_id of the new object, type (group or polygon), member_count, bounds_mm, page_id, page_name, source_frame_id, source_deleted, characters_converted and fonts_used[] {family, style}; warns that the text is no longer searchable or editable.

Parameters (4)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Object id from get_page_state.
confirmbooleanrequired
Required: true confirms the irreversible conversion.
delete_originalboolean
Remove the text frame after converting. Default true.

↑ Top

Styles, fonts, swatches17 tools

list_paragraph_stylesList paragraph and character stylesread-only

List the paragraph styles (Absatzformate) of the document, including those in style groups: styles[] {name, style_id, group ("" at top level, "Group/Subgroup" nested), based_on, font_family, font_style, point_size, leading_pt (null when automatic), leading_auto, fill_swatch, alignment, space_before_pt, space_after_pt, hyphenation, tracking, keep_options, hyphenation_options, justification_options} and the character styles (Zeichenformate) as character_styles[] {name, style_id, group, based_on, font_family, font_style, point_size, fill_swatch, tracking – null for attributes the style does not set}. Internal styles whose name starts with "[" are excluded (internal_styles_excluded counts them). Read-only.

Parameters (1)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.

define_paragraph_styleDefine a paragraph style

Create a paragraph style (Absatzformat) with name and any of font_family, font_style (exact InDesign style name, e.g. "75 Bold"), size_pt, leading_pt (points or "auto"), alignment (left, center, right, justify = Blocksatz with the last line left), color_hex (creates an RGB swatch named after the hex value) or swatch_name (an existing swatch by exact name – the way to a CMYK or spot colour; not together with color_hex), space_before_pt, space_after_pt, tracking (Laufweite in 1/1000 em), hyphenation, and the option groups keep_options (Umbruchoptionen: keep_with_next, keep_first_lines, keep_last_lines, keep_lines_together, keep_all_lines_together, keep_with_previous, start_paragraph), hyphenation_options (Silbentrennungseinstellungen) and justification_options (Blocksatz-Abstände, composer). Indents in mm: left_indent_mm, first_line_indent_mm (negative for a hanging indent, never further left than the left indent), right_indent_mm, last_line_indent_mm. tab_stops[] {position_mm, alignment left|center|right|character, leader, align_on} replaces the whole tab list ([] clears it); language selects the dictionary by the name InDesign shows, its untranslated name or an ICU locale (de_DE, en_GB – the safest form). The answer reads them back under indents {left_indent_mm, first_line_indent_mm, right_indent_mm, last_line_indent_mm, tab_stops[], language {name, untranslated_name, icu_locale}}. InDesign names a family with a format suffix such as "Source Sans 3 (OTF)" or "(TT)" when it knows the family in more than one format; pass the family with or without that suffix – the connector matches both and reads back the name InDesign uses. Strict keep options can produce overset or empty column ends – check overset and get_frame_lines afterwards. on_collision decides what happens when the name exists: error (default), update or version ("Name 2"). The font must be installed: InDesign rejects a font it does not have, even as family plus style (not_found with available_styles) – define such styles on the machine that has the font. Returns style_id, name (differs from the request with version), collision (none, updated, versioned), existed, applied[] and the definition read back (with keep_options, hyphenation_options and justification_options as InDesign holds them).

Parameters (23)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
namestringrequired
Style name; must not start with "[". (min. 1 chars)
font_familystring
Font family, e.g. "Futura PT". (min. 1 chars)
font_stylestring
Exact style name, e.g. "Book" or "75 Bold" (see get_font_info_at_index). (min. 1 chars)
size_ptnumber
Point size (Schriftgrad). (> 0, ≤ 1296)
leading_ptone of
Leading in points, or "auto".
number
(≥ 0)
string
alignmentstring
Alignment; justify = Blocksatz, last line left. (values: "left", "center", "right", "justify")
color_hexstring
Text colour as hex; an RGB swatch named after it is created if needed. Not together with swatch_name.
swatch_namestring
Text colour as an existing swatch by exact name (CMYK, spot, tint or gradient; see list_swatches). Not together with color_hex. (min. 1 chars)
space_before_ptnumber
Space before (Abstand davor) in points. (≥ 0)
space_after_ptnumber
Space after (Abstand danach) in points. (≥ 0)
trackingnumber
Tracking (Laufweite) in 1/1000 em; a character style with its own tracking replaces this value where it is applied. (≥ -1000, ≤ 10000)
hyphenationboolean
Hyphenation on or off (Silbentrennung).
keep_optionsobject
Keep options (Umbruchoptionen / Absatzkontrolle). Whatever is omitted stays.
keep_with_nextinteger
Lines of the next paragraph that stay with this one (0–5). A heading (Zwischentitel) usually keeps 2. (≥ 0, ≤ 5)
keep_first_linesinteger
Lines kept together at the start of the paragraph (Schusterjungen). InDesign default 2. Only effective with keep_lines_together true. (≥ 1, ≤ 100)
keep_last_linesinteger
Lines kept together at the end of the paragraph (Hurenkinder). InDesign default 2. Only effective with keep_lines_together true. (≥ 1, ≤ 100)
keep_lines_togetherboolean
Switch on the first/last line control.
keep_all_lines_togetherboolean
Keep the whole paragraph in one column.
keep_with_previousboolean
Keep with the previous paragraph (InDesign CC and later; invalid_state on older versions).
start_paragraphstring
Where the paragraph starts (Absatz beginnen). (values: "anywhere", "next_column", "next_frame", "next_page", "next_odd_page", "next_even_page")
hyphenation_optionsobject
Hyphenation settings (Silbentrennungseinstellungen). The plain hyphenation switch stays a separate parameter. Whatever is omitted stays.
words_longer_thaninteger
Minimum word length in characters. InDesign default 5. (≥ 3, ≤ 25)
after_firstinteger
Characters before the first hyphen. InDesign default 2. (≥ 1, ≤ 15)
before_lastinteger
Characters after the last hyphen. InDesign default 2. (≥ 1, ≤ 15)
ladder_limitinteger
Consecutive hyphenated lines allowed; 0 = unlimited. InDesign default 3 – the same limit Forssman/de Jong (Detailtypografie) give. (≥ 0, ≤ 25)
zone_mmnumber
Hyphenation zone in mm (ragged text only). (≥ 0, ≤ 300)
capitalized_wordsboolean
Hyphenate capitalized words (proper names).
last_wordboolean
Hyphenate the last word of a paragraph.
across_columnsboolean
Hyphenate across columns, frames and pages.
weightinteger
Better spacing (0) … fewer hyphens (10), the slider of the hyphenation dialog. InDesign default 5. (≥ 0, ≤ 10)
justification_optionsobject
Justification settings (Abstandseinstellungen für Blocksatz). Whatever is omitted stays. The paragraph composer recomposes the whole paragraph on every change – check get_frame_lines afterwards.
word_spacingobject
Word spacing (Wortabstand) in percent {min, desired, max}, each 0 to 1000; omitted members keep their value; min <= desired <= max must hold after merging. InDesign default 80/100/133.
minnumber
(≥ 0, ≤ 1000)
desirednumber
(≥ 0, ≤ 1000)
maxnumber
(≥ 0, ≤ 1000)
letter_spacingobject
Letter spacing (Zeichenabstand) in percent {min, desired, max}, each -100 to 500; omitted members keep their value; min <= desired <= max must hold after merging. InDesign default 0/0/0.
minnumber
(≥ -100, ≤ 500)
desirednumber
(≥ -100, ≤ 500)
maxnumber
(≥ -100, ≤ 500)
glyph_scalingobject
Glyph scaling (Glyphenskalierung) in percent {min, desired, max}, each 50 to 200; omitted members keep their value; min <= desired <= max must hold after merging. InDesign default 100/100/100.
minnumber
(≥ 50, ≤ 200)
desirednumber
(≥ 50, ≤ 200)
maxnumber
(≥ 50, ≤ 200)
single_word_justificationstring
Alignment of a line holding a single word (Einzelwortausrichtung). (values: "full", "left", "center", "right")
composerstring
Adobe Paragraph Composer or Single-line Composer (Absatzsetzer / Einzeilensetzer); set language-independently, read back as paragraph, single_line or other with composer_name. (values: "paragraph", "single_line")
auto_leading_percentnumber
Auto leading in percent of the point size. InDesign default 120. (≥ 0, ≤ 500)
left_indent_mmnumber
Left indent (Einzug links) in mm. (≥ 0, ≤ 3048)
first_line_indent_mmnumber
First-line indent (Einzug erste Zeile) in mm; negative = hanging indent, at most -left_indent_mm. (≥ -3048, ≤ 3048)
right_indent_mmnumber
Right indent (Einzug rechts) in mm. (≥ 0, ≤ 3048)
last_line_indent_mmnumber
Last-line right indent (Einzug letzte Zeile) in mm. (≥ -3048, ≤ 3048)
tab_stopsarray of object
Complete list of tab stops (Tabulatoren); replaces every existing tab stop, [] removes all. Text reaches a tab stop through {{tab}} in set_text.
items
position_mmnumberrequired
Tab position in mm from the left edge of the column. (≥ 0, ≤ 3048)
alignmentstring
Tab alignment. Default left. (values: "left", "center", "right", "character")
leaderstring
Leader (Füllzeichen), e.g. "." for a table of contents. Default none.
align_onstring
Character to align on (only with alignment character), e.g. ",". (min. 1 chars)
languagestring
Language of the text (Sprache, for hyphenation and spelling): the name InDesign shows (e.g. "Deutsch: 2006 Rechtschreibreform", "Englisch: Großbritannien"), its untranslated name as InDesign holds it ("English: UK", but "de_DE_2006" for German) or an ICU locale ("de_DE", "en_GB" – the safest form); unknown names fail with not_found and the available list. (min. 1 chars)
on_collisionstring
What to do when the name exists: error (default) fails, update changes the existing one, version creates "Name 2". (values: "error", "update", "version")

define_character_styleDefine a character style

Create a character style (Zeichenformat) with name and at least one of font_family, font_style (exact InDesign style name), point_size, fill_hex (creates an RGB swatch) or swatch_name (an existing swatch by exact name; not together with fill_hex), and tracking (Laufweite in 1/1000 em, -1000 to 10000; where the style is applied it replaces the tracking of the paragraph style – see apply_character_style_to_range). on_collision: error (default), update or version. Returns style_id, name, collision (none, updated, versioned), existed, applied[] and the definition read back (null for attributes the style leaves untouched). InDesign names a family with a format suffix such as "Source Sans 3 (OTF)" or "(TT)" when it knows the family in more than one format; pass the family with or without that suffix – the connector matches both and reads back the name InDesign uses.

Parameters (9)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
namestringrequired
Style name; must not start with "[". (min. 1 chars)
font_familystring
Font family. (min. 1 chars)
font_stylestring
Exact style name, e.g. "75 Bold". (min. 1 chars)
point_sizenumber
Point size. (> 0, ≤ 1296)
fill_hexstring
Text colour as hex; an RGB swatch is created if needed. Not together with swatch_name.
swatch_namestring
Text colour as an existing swatch by exact name (CMYK, spot, tint or gradient; see list_swatches). Not together with fill_hex. (min. 1 chars)
trackingnumber
Tracking (Laufweite) in 1/1000 em. (≥ -1000, ≤ 10000)
on_collisionstring
What to do when the name exists: error (default) fails, update changes the existing one, version creates "Name 2". (values: "error", "update", "version")

apply_paragraph_styleApply a paragraph style to a whole frame

Apply a paragraph style (Absatzformat) to every paragraph of a text frame. By default (clear_overrides true) local formatting and character styles are cleared first, so the print matches the style, not only its name; with clear_overrides false deliberate local bold or italic stays, and so does every stray override. For a threaded frame only the paragraphs touching this frame are formatted – use apply_paragraph_style_to_range over the whole story (0 to story_length from get_frame_text) for the rest. Returns frame_id, style_applied, affected_paragraphs, overrides_cleared and threaded.

Parameters (4)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Object id from get_page_state.
style_namestringrequired
Paragraph style name (see list_paragraph_styles). (min. 1 chars)
clear_overridesboolean
Clear local character formatting and character styles first. Default true.

apply_paragraph_style_to_rangeApply a paragraph style to a range

Apply a paragraph style (Absatzformat) to every paragraph touched by the character range start_index (inclusive) to end_index (exclusive) of the story of a text frame. Clears paragraph overrides, character styles and local character formatting of those paragraphs; never changes text. Caveat: when start_index is the paragraph mark of the preceding paragraph, that paragraph is formatted too (warning) – start one character later. Recommended order: base style over the whole story first, then the special styles. One call is enough (it runs the clean-up twice internally). Returns frame_id, story_id, style_applied, affected_paragraphs, first_paragraph_start_index and last_paragraph_end_index.

Parameters (5)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Object id from get_page_state.
style_namestringrequired
Paragraph style name (see list_paragraph_styles). (min. 1 chars)
start_indexintegerrequired
First character of the range (inclusive), a story index from get_frame_text. (≥ 0)
end_indexintegerrequired
End of the range (exclusive); must be greater than start_index. (≥ 0)

apply_character_style_to_rangeApply a character style to a range

Apply an existing character style (Zeichenformat) to the characters start_index (inclusive) to end_index (exclusive) of the story of a text frame. The style must exist (define_character_style; list_paragraph_styles lists them). Never changes text. Returns frame_id, characters_affected, style_applied and tracking {effective, character_style, paragraph_style}: a character style that carries its own tracking replaces the tracking of the paragraph style for that range (it is not added) – a paragraph style with tracking 100 plus a character style with tracking 260 gives 260, visibly wider. effective is what InDesign uses at the first character of the range; character_style is null when the style leaves tracking alone.

Parameters (5)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Object id from get_page_state.
character_style_namestringrequired
Existing character style name. (min. 1 chars)
start_indexintegerrequired
First character of the range (inclusive), a story index from get_frame_text. (≥ 0)
end_indexintegerrequired
End of the range (exclusive); must be greater than start_index. (≥ 0)

apply_character_format_to_rangeFormat a range locally

Local character formatting without a style for the characters start_index (inclusive) to end_index (exclusive) of the story of a text frame: font_style (exact InDesign style name – fetch it with get_font_info_at_index first, "75 Bold" rather than "Bold"; optional font_family to switch the family), swatch_name (an existing swatch, exact name; built-ins are "Black", "Paper", "None"), superscript (true/false), tracking (Laufweite in 1/1000 em, -1000 to 10000; the server configuration can set a tolerance beyond which a warning is given), point_size (0–1296, the only way to a size without a paragraph style). At least one attribute. Never changes text. Returns applied[], point_size_applied, font_family, font_style and fill_color read back at the first character for a cross-check, plus characters_affected.

Parameters (10)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Object id from get_page_state.
start_indexintegerrequired
First character of the range (inclusive), a story index from get_frame_text. (≥ 0)
end_indexintegerrequired
End of the range (exclusive); must be greater than start_index. (≥ 0)
font_familystring
Font family to switch to (optional; needs the font to be installed unless font_style is given too). (min. 1 chars)
font_stylestring
Exact style name within the family, e.g. "75 Bold". (min. 1 chars)
swatch_namestring
Existing swatch name for the text colour. (min. 1 chars)
superscriptboolean
true sets superscript, false resets to normal position.
trackingnumber
Tracking in 1/1000 em. (≥ -1000, ≤ 10000)
point_sizenumber
Point size. (> 0, ≤ 1296)

set_paragraph_optionsSet paragraph options (alignment, hyphenation, keep, justification)

Set paragraph options of a text frame: alignment (left, center, right, justify_left, justify_center, justify_right, justify_full), hyphenation (true/false – usually false for headlines), no_break (true/false, keeps the text of the paragraphs on one line), and the option groups keep_options (Umbruchoptionen: keep_with_next, keep_first_lines, keep_last_lines, keep_lines_together, keep_all_lines_together, keep_with_previous, start_paragraph), hyphenation_options (Silbentrennungseinstellungen: words_longer_than, after_first, before_last, ladder_limit, zone_mm, capitalized_words, last_word, across_columns, weight) and justification_options (word_spacing, letter_spacing, glyph_scaling, single_word_justification, composer, auto_leading_percent). Indents in mm: left_indent_mm, first_line_indent_mm (negative for a hanging indent, never further left than the left indent), right_indent_mm, last_line_indent_mm. tab_stops[] {position_mm, alignment left|center|right|character, leader, align_on} replaces the whole tab list ([] clears it); language selects the dictionary by the name InDesign shows, its untranslated name or an ICU locale (de_DE, en_GB – the safest form). The answer reads them back under indents {left_indent_mm, first_line_indent_mm, right_indent_mm, last_line_indent_mm, tab_stops[], language {name, untranslated_name, icu_locale}}. Without start_index/end_index every paragraph of the frame is changed; with them every paragraph the range touches. Returns paragraphs_changed, alignment, hyphenation, no_break, keep_options, hyphenation_options, justification_options, indents of the first paragraph read back after the change, and overset of the story – strict keep options can push text into overset or leave empty column ends; check get_frame_lines.

Parameters (16)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Object id from get_page_state.
alignmentstring
Paragraph alignment. (values: "left", "center", "right", "justify_left", "justify_center", "justify_right", "justify_full")
hyphenationboolean
Hyphenation on or off.
no_breakboolean
No-break for the paragraph text.
keep_optionsobject
Keep options (Umbruchoptionen / Absatzkontrolle). Whatever is omitted stays.
keep_with_nextinteger
Lines of the next paragraph that stay with this one (0–5). A heading (Zwischentitel) usually keeps 2. (≥ 0, ≤ 5)
keep_first_linesinteger
Lines kept together at the start of the paragraph (Schusterjungen). InDesign default 2. Only effective with keep_lines_together true. (≥ 1, ≤ 100)
keep_last_linesinteger
Lines kept together at the end of the paragraph (Hurenkinder). InDesign default 2. Only effective with keep_lines_together true. (≥ 1, ≤ 100)
keep_lines_togetherboolean
Switch on the first/last line control.
keep_all_lines_togetherboolean
Keep the whole paragraph in one column.
keep_with_previousboolean
Keep with the previous paragraph (InDesign CC and later; invalid_state on older versions).
start_paragraphstring
Where the paragraph starts (Absatz beginnen). (values: "anywhere", "next_column", "next_frame", "next_page", "next_odd_page", "next_even_page")
hyphenation_optionsobject
Hyphenation settings (Silbentrennungseinstellungen). The plain hyphenation switch stays a separate parameter. Whatever is omitted stays.
words_longer_thaninteger
Minimum word length in characters. InDesign default 5. (≥ 3, ≤ 25)
after_firstinteger
Characters before the first hyphen. InDesign default 2. (≥ 1, ≤ 15)
before_lastinteger
Characters after the last hyphen. InDesign default 2. (≥ 1, ≤ 15)
ladder_limitinteger
Consecutive hyphenated lines allowed; 0 = unlimited. InDesign default 3 – the same limit Forssman/de Jong (Detailtypografie) give. (≥ 0, ≤ 25)
zone_mmnumber
Hyphenation zone in mm (ragged text only). (≥ 0, ≤ 300)
capitalized_wordsboolean
Hyphenate capitalized words (proper names).
last_wordboolean
Hyphenate the last word of a paragraph.
across_columnsboolean
Hyphenate across columns, frames and pages.
weightinteger
Better spacing (0) … fewer hyphens (10), the slider of the hyphenation dialog. InDesign default 5. (≥ 0, ≤ 10)
justification_optionsobject
Justification settings (Abstandseinstellungen für Blocksatz). Whatever is omitted stays. The paragraph composer recomposes the whole paragraph on every change – check get_frame_lines afterwards.
word_spacingobject
Word spacing (Wortabstand) in percent {min, desired, max}, each 0 to 1000; omitted members keep their value; min <= desired <= max must hold after merging. InDesign default 80/100/133.
minnumber
(≥ 0, ≤ 1000)
desirednumber
(≥ 0, ≤ 1000)
maxnumber
(≥ 0, ≤ 1000)
letter_spacingobject
Letter spacing (Zeichenabstand) in percent {min, desired, max}, each -100 to 500; omitted members keep their value; min <= desired <= max must hold after merging. InDesign default 0/0/0.
minnumber
(≥ -100, ≤ 500)
desirednumber
(≥ -100, ≤ 500)
maxnumber
(≥ -100, ≤ 500)
glyph_scalingobject
Glyph scaling (Glyphenskalierung) in percent {min, desired, max}, each 50 to 200; omitted members keep their value; min <= desired <= max must hold after merging. InDesign default 100/100/100.
minnumber
(≥ 50, ≤ 200)
desirednumber
(≥ 50, ≤ 200)
maxnumber
(≥ 50, ≤ 200)
single_word_justificationstring
Alignment of a line holding a single word (Einzelwortausrichtung). (values: "full", "left", "center", "right")
composerstring
Adobe Paragraph Composer or Single-line Composer (Absatzsetzer / Einzeilensetzer); set language-independently, read back as paragraph, single_line or other with composer_name. (values: "paragraph", "single_line")
auto_leading_percentnumber
Auto leading in percent of the point size. InDesign default 120. (≥ 0, ≤ 500)
left_indent_mmnumber
Left indent (Einzug links) in mm. (≥ 0, ≤ 3048)
first_line_indent_mmnumber
First-line indent (Einzug erste Zeile) in mm; negative = hanging indent, at most -left_indent_mm. (≥ -3048, ≤ 3048)
right_indent_mmnumber
Right indent (Einzug rechts) in mm. (≥ 0, ≤ 3048)
last_line_indent_mmnumber
Last-line right indent (Einzug letzte Zeile) in mm. (≥ -3048, ≤ 3048)
tab_stopsarray of object
Complete list of tab stops (Tabulatoren); replaces every existing tab stop, [] removes all. Text reaches a tab stop through {{tab}} in set_text.
items
position_mmnumberrequired
Tab position in mm from the left edge of the column. (≥ 0, ≤ 3048)
alignmentstring
Tab alignment. Default left. (values: "left", "center", "right", "character")
leaderstring
Leader (Füllzeichen), e.g. "." for a table of contents. Default none.
align_onstring
Character to align on (only with alignment character), e.g. ",". (min. 1 chars)
languagestring
Language of the text (Sprache, for hyphenation and spelling): the name InDesign shows (e.g. "Deutsch: 2006 Rechtschreibreform", "Englisch: Großbritannien"), its untranslated name as InDesign holds it ("English: UK", but "de_DE_2006" for German) or an ICU locale ("de_DE", "en_GB" – the safest form); unknown names fail with not_found and the available list. (min. 1 chars)
start_indexinteger
Optional range start (inclusive); without it the whole frame. (≥ 0)
end_indexinteger
Optional range end (exclusive). (≥ 0)

get_font_info_at_indexFont at a characterread-only

Read the font at story index of a text frame: font_family, font_style (the exact style name to use in apply_character_format_to_range or define_paragraph_style), font_status (installed, substituted, not_available), available_styles[] of that family as installed, point_size, paragraph_style, character_style (localized name) and character_style_is_none. Read-only.

Parameters (3)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Object id from get_page_state.
indexintegerrequired
Story index of the character (from get_frame_text). (≥ 0)

find_font_usageWhere is a font usedread-only

Find where fonts are used in the document. fonts_used[] {family, style, status (installed, substituted, not_available), occurrences, characters} is always complete; occurrences[] {family, style, status, story_id, frame_ids[], page_id, page_name, is_master, start_index, end_index, snippet} is filtered by font_family and font_style (exact names, case-insensitive – "Futura" does not match "Futura PT"), only_missing (status other than installed) and include_master_pages (default true). Runs of the same family and style are merged; at most 500 occurrences are listed. Read-only.

Parameters (5)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
font_familystring
Family to filter occurrences by (case-insensitive; a format suffix such as "(OTF)" may be left out). (min. 1 chars)
font_stylestring
Style to filter occurrences by (exact, case-insensitive). (min. 1 chars)
only_missingboolean
List only occurrences of fonts that are not installed. Default false.
include_master_pagesboolean
Include stories on master pages. Default true.

replace_fontReplace a font everywhere

Replace every use of a font family (or one style of it) in the document by another installed font – InDesign's "find font / replace" as one call: in paragraph and character styles and in local formatting, on document and master pages. The standard step after open_document reports missing_fonts, and when a publication changes its typeface. from_family (required), from_style (optional: without it every style of the family is replaced, keeping the style name where it exists in the target family – styles that do not exist there are left alone with a warning listing available_styles); to_family (required, must be installed – otherwise not_found with available_styles), to_style (only with from_style; default the same style name). scope all (default) | styles_only | local_only. include_master_pages (default true), include_locked_layers (default false – stories on locked layers are skipped and listed in skipped_locked). dry_run true only counts. Never changes text. Returns from, to, styles_changed[] {kind, name, from_style, to_style}, runs_changed, characters_changed, stories_touched, remaining_occurrences (runs still using the old font – 0 when everything was reached; remaining_where lists up to 20), skipped_locked[], styles_missing_in_target[], overset_stories[] (InDesign recomposes every paragraph – check get_frame_lines) and dry_run. Pitfalls: style names are family-specific ("75 Bold" is not "Bold") – check them with get_font_info_at_index; a missing font exists in the document only as a name and is replaced through that name; composite fonts and text in placed graphics are not affected. InDesign names a family with a format suffix such as "Source Sans 3 (OTF)" or "(TT)" when it knows the family in more than one format; pass the family with or without that suffix – the connector matches both and reads back the name InDesign uses.

Parameters (9)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
from_familystringrequired
Font family to replace, e.g. the missing one from find_font_usage. (min. 1 chars)
from_stylestring
Only this style of the family. Without it all styles. (min. 1 chars)
to_familystringrequired
Installed target family. (min. 1 chars)
to_stylestring
Target style; only together with from_style. Default: the same style name. (min. 1 chars)
scopestring
Styles and/or local formatting. Default all. (values: "all", "styles_only", "local_only")
include_master_pagesboolean
Also master pages. Default true.
include_locked_layersboolean
Also stories on locked layers. Default false.
dry_runboolean
Only count and locate, change nothing. Default false.

debug_inspect_runInspect formatting at a characterread-only

Diagnosis only: the effective formatting at story index (default 0) of a text frame – point_size, leading_pt, applied_paragraph_style, applied_character_style (InDesign's own name, localized – "[Ohne]" in German) with character_style_is_none (true when no character style is applied, the language-independent check), fill_color, applied_font, font_style, tracking, horizontal_scale, vertical_scale, style_overridden (local formatting on top of the style), frame_scale {horizontal, vertical} of the frame and paragraph {index (0-based in the story), start_index (story index of its first character), alignment, hyphenation, keep_options, hyphenation_options, justification_options} of the paragraph holding the character. With style_name also style {found, kind, matches, duplicated, nested, groups[], definition} – whether the name occurs more than once or inside a group. The only way to see local formatting hiding behind a correct style name. Read-only.

Parameters (4)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Object id from get_page_state.
indexinteger
Story index to inspect. Default 0. (≥ 0)
style_namestring
Paragraph or character style name to look up. (min. 1 chars)

import_stylesImport styles from a file

Load styles and swatches from another InDesign file (.indd, .indt, .idml) into this document: kinds paragraph, character, object, table, cell, swatches (default all six); on_conflict keep_existing (default: a style whose name exists already is not loaded), overwrite (existing styles with the same name are replaced) or rename (imported copies get a new name). Returns results per kind {before, after, added[]} and total_added; warns when nothing new arrived. Typical use when setting up a new issue from the previous one. Swatches are loaded without a conflict strategy (existing names stay).

Parameters (4)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
file_pathstringrequired
Real path of an .indd, .indt or .idml file on the machine running InDesign. (min. 1 chars)
kindsarray of string
Which kinds to import. Default: all. (min. 1 items)
on_conflictstring
What happens to a name that exists already. Default keep_existing. (values: "keep_existing", "overwrite", "rename")

list_swatchesList swatchesread-only

List the swatches (Farbfelder) of the document: swatches[] {swatch_id, name, kind (none, color, tint, gradient, mixed_ink), space (RGB, CMYK, LAB, MIXED_INK), model (process, spot, registration), values (RGB 0–255 or CMYK percent; ink percentages for mixed inks), tint_percent and base_color for tints, stop_count, type (linear, radial) and stops[] {index, swatch_name, location, midpoint} for gradients, built_in}. include_built_in false hides None, Black, Paper and Registration. Read-only. Use the exact names for swatch_name parameters (create_line, create_rectangle, set_frame_appearance, apply_character_format_to_range); hex parameters create RGB swatches, which print differently from the CMYK swatches of the document.

Parameters (2)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
include_built_inboolean
Also list None, Black, Paper and Registration. Default true.

create_swatchCreate a colour swatch

Create a process colour swatch (Farbfeld) with the exact name (1–60 characters) from hex (RGB, "#1A2B3C") or cmyk ({c, m, y, k} in percent – for print production); exactly one of the two. on_collision: error (default), update (rewrites the values of the existing colour) or version ("Name 2"). Returns name, swatch_id, collision (none, updated, versioned), existed, space (rgb or cmyk) and values.

Parameters (5)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
namestringrequired
Exact swatch name; must not start with "[". (min. 1 chars)
hexstring
RGB colour as hex.
cmykobject
CMYK values in percent.
cnumberrequired
(≥ 0, ≤ 100)
mnumberrequired
(≥ 0, ≤ 100)
ynumberrequired
(≥ 0, ≤ 100)
knumberrequired
(≥ 0, ≤ 100)
on_collisionstring
What to do when the name exists: error (default) fails, update changes the existing one, version creates "Name 2". (values: "error", "update", "version")

create_gradient_swatchCreate a gradient swatch

Create a gradient swatch (Verlaufsfarbfeld) named name with type linear (default) or radial and stops[] (2–20, in order): each stop names exactly one of swatch_name (an existing colour or tint swatch – not a gradient or mixed ink), hex (creates an RGB swatch) or cmyk {c, m, y, k} (creates a CMYK swatch "<name> Stopp <n>"), plus location 0–100 (ascending; a first stop above 0 or a last below 100 gives a warning) and optional midpoint 13–87. on_collision error (default), update (rewrites type and stops of an existing gradient) or version ("<name> 2"). The swatch is then used with fill_swatch_name / stroke_swatch_name in create_rectangle, create_ellipse, create_polygon, create_line and set_frame_appearance, and the angle with gradient_fill_angle_deg. Returns name, swatch_id, type, stops[] {index, swatch_name, location, midpoint} read back, stop_count, collision, existed, previous (with update), swatch_ids of new colour swatches. Note: gradients built from RGB swatches stay RGB – build print gradients from CMYK swatches; how the export renders them depends on the PDF preset.

Parameters (5)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
namestringrequired
Swatch name, exact; must not start with "[". (min. 1 chars)
typestring
Gradient type. Default linear. (values: "linear", "radial")
stopsarray of objectrequired
Colour stops in order. (min. 2 items, max. 20 items)
items
swatch_namestring
Existing colour or tint swatch (exact name). (min. 1 chars)
hexstring
RGB colour as hex; creates a swatch named after the value.
cmykobject
CMYK values in percent; creates a swatch "<name> Stopp <n>".
cnumberrequired
(≥ 0, ≤ 100)
mnumberrequired
(≥ 0, ≤ 100)
ynumberrequired
(≥ 0, ≤ 100)
knumberrequired
(≥ 0, ≤ 100)
locationnumberrequired
Position of the stop in percent (0–100), ascending. (≥ 0, ≤ 100)
midpointnumber
Midpoint to the next stop in percent (13–87). (≥ 13, ≤ 87)
on_collisionstring
What to do when the name exists. Default error. (values: "error", "update", "version")

replace_swatchReplace a swatch everywhere

Replace every use of a swatch (fills, strokes, text, paragraph, character and object styles, tables, gradient stops) with another existing swatch and remove the old one – InDesign's "delete swatch … replace with". Typical use: RGB swatches from a foreign document replaced by CMYK swatches created with create_swatch, or duplicate swatches merged. old_name or old_swatch_id (exact, as list_swatches shows it; built-in swatches cannot be replaced), new_name or new_swatch_id (must exist – colour, tint or gradient). delete_old true (default) lets InDesign replace everything and removes the old swatch; false only reassigns text runs, fills, strokes and paragraph/character styles by search and keeps the swatch (object styles, table styles and gradient stops then keep the old one – warning). dry_run true only counts. A swatch that serves as the base of a mixed ink can be refused by InDesign (invalid_state). Returns old {name, swatch_id, kind, space, values}, new {…}, deleted, usage_before {text_runs, fills, strokes, paragraph_styles, character_styles, object_styles, tables (null – not counted), gradients}, reassigned (with delete_old false), remaining_swatches and dry_run. A change of colour space (RGB to CMYK) is no colour management – the printed colour can differ; check the values with list_swatches first, and re-read list_swatches afterwards.

Parameters (8)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
old_namestring
Swatch to replace, by exact name. (min. 1 chars)
old_swatch_idinteger
Swatch to replace, by id from list_swatches.
new_namestring
Replacement swatch, by exact name (must exist). (min. 1 chars)
new_swatch_idinteger
Replacement swatch, by id.
delete_oldboolean
Remove the old swatch after replacing. Default true.
dry_runboolean
Only count the uses, change nothing. Default false.
include_locked_layersboolean
Also change text on locked layers when reassigning by search. Default false.

↑ Top

Tables4 tools

create_tableCreate a table

Create a table (Tabelle) in the story of a text frame: rows (body rows) x columns, plus header_rows and footer_rows; position end (default, after the existing text, in its own paragraph), start, or replace (the story is emptied first). Optional cells fill it row-major (header rows first, then body, then footer), table_style, cell_style, paragraph_style (applied inside every cell), column_widths_mm or width_mm. Returns table_id, table_index (in the story), frame_id (where the table starts), story_offset_index, rows/body_rows/header_rows/footer_rows/columns, table_style, width_mm, height_mm, column_widths_mm, cells_written, overflowing_cells, overset. A table that does not fit makes the story overflow – warning; enlarge the frame or thread another one. Use set_table_cells for further contents and get_table to read it back.

Parameters (13)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Object id from get_page_state.
rowsintegerrequired
Body rows (Textzeilen), 1 to 1000. (≥ 1, ≤ 1000)
columnsintegerrequired
Columns, 1 to 100. (≥ 1, ≤ 100)
header_rowsinteger
Header rows (Tabellenkopf), repeated when the table breaks. Default 0. (≥ 0, ≤ 20)
footer_rowsinteger
Footer rows (Tabellenfuß). Default 0. (≥ 0, ≤ 20)
positionstring
Where in the story: end (default), start, or replace the whole story text. (values: "end", "start", "replace")
cellsarray of array of one of
Rows of cell texts, row-major: [["Datum","Ort"],["12.05.","A"]]. Numbers are written as text, null leaves the cell untouched. Line breaks (\n) become paragraphs inside the cell. (min. 1 items, max. 1000 items)
table_stylestring
Table style (Tabellenformat) by exact name; get_table lists the available ones. (min. 1 chars)
cell_stylestring
Cell style (Zellenformat) by exact name; get_table lists the available ones. (min. 1 chars)
paragraph_stylestring
Paragraph style applied in every cell (exact name, see list_paragraph_styles). (min. 1 chars)
column_widths_mmarray of number
Column widths in mm, one per column. (min. 1 items, max. 100 items)
width_mmnumber
Total table width in mm (columns scaled proportionally). Ignored when column_widths_mm is given. (> 0)

set_table_cellsWrite table cells

Write cell texts into an existing table from a matrix, starting at start_row/start_column (0-based, rows counted across header, body and footer). By default the matrix must fit; grow true adds body rows and columns as needed. Optional paragraph_style and cell_style for the written cells. Cells hidden by a merged cell are skipped (warning). Returns cells_written, cells_skipped, rows_added, columns_added, overflowing_cells (cells whose text does not fit – widen the column or shorten), overset of the story, and the table summary as get_table.

Parameters (9)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Object id from get_page_state.
table_indexinteger
Which table of the story, in text order, 0 = first. Default 0. (≥ 0)
cellsarray of array of one ofrequired
Rows of cell texts, row-major: [["Datum","Ort"],["12.05.","A"]]. Numbers are written as text, null leaves the cell untouched. Line breaks (\n) become paragraphs inside the cell. (min. 1 items, max. 1000 items)
start_rowinteger
First row to write, 0-based across all rows. Default 0. (≥ 0)
start_columninteger
First column to write, 0-based. Default 0. (≥ 0)
growboolean
Add rows and columns when the matrix exceeds the table. Default false = invalid_argument.
paragraph_stylestring
Paragraph style applied in the written cells (exact name). (min. 1 chars)
cell_stylestring
Cell style (Zellenformat) by exact name; get_table lists the available ones. (min. 1 chars)

set_table_styleTable style, cell style, widths

Change how a table looks: table_style (Tabellenformat), cell_style with cell_style_scope all|header|body|footer, column_widths_mm (one per column) or width_mm (proportional), header_rows and footer_rows (converted from existing rows; at least one body row must remain). At least one parameter. Unknown style names are not_found with the available names in the details. Returns the table summary (widths, heights, counts, table_style), cells_styled, changed, overset.

Parameters (10)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Object id from get_page_state.
table_indexinteger
Which table of the story, in text order, 0 = first. Default 0. (≥ 0)
table_stylestring
Table style (Tabellenformat) by exact name; get_table lists the available ones. (min. 1 chars)
cell_stylestring
Cell style (Zellenformat) by exact name; get_table lists the available ones. (min. 1 chars)
cell_style_scopestring
Which rows get cell_style. Default all. (values: "all", "header", "body", "footer")
column_widths_mmarray of number
Column widths in mm, one per column. (min. 1 items, max. 100 items)
width_mmnumber
Total table width in mm, columns scaled proportionally. (> 0)
header_rowsinteger
Number of header rows (taken from the top rows). (≥ 0, ≤ 20)
footer_rowsinteger
Number of footer rows (taken from the bottom rows). (≥ 0, ≤ 20)

get_tableRead a tableread-only

Read a table of the story of a text frame: table_id, table_index, table_count (tables in the story), frame_id (where it starts), story_offset_index, rows/body_rows/header_rows/footer_rows/columns, row_types, table_style, width_mm, height_mm, column_widths_mm, row_heights_mm, rows_text (matrix of cell texts, null where a merged cell covers the position, cut at max_chars_per_cell with truncated true), merged_cells {row, column, row_span, column_span}, overflowing_cells, cell_styles (name and count), available_table_styles, available_cell_styles, overset. Read-only. not_found when the story has no table or table_index is beyond table_count.

Parameters (4)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
frame_idintegerrequired
Object id from get_page_state.
table_indexinteger
Which table of the story, in text order, 0 = first. Default 0. (≥ 0)
max_chars_per_cellinteger
Text budget per cell. Default 200. (≥ 1)

↑ Top

Checking2 tools

preflight_documentRun InDesign® preflightread-only

Run InDesign's preflight (Preflight) with profile_name or, without it, the document's working profile (falls back to the first available profile when the working profile is invalid). Waits for the process, returns profile_used, summary ("None" when there are no errors), error_count and findings[] with category, description, page_name and item, capped by max_findings (1–500, default 100). With list_profiles_only true only profiles[] is returned. Read-only: the process is created, awaited and removed. Caveat: overset text (Übersatz) is not always reported with the right page – get_frame_text on the last frame of each story is the reliable check.

Parameters (4)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
profile_namestring
Preflight profile to use. Default: the document's working profile.
list_profiles_onlyboolean
Only list the available profiles, run nothing.
max_findingsinteger
Cap for findings[]. Default 100. (≥ 1, ≤ 500)

check_typographyCheck typography rules (read-only)read-only

Find violations of general typesetting rules and report them – never change anything. The rule catalogue is a data table in the package (rules/typography-rules.json): character rules run as InDesign GREP searches (double_space, space_before_punct, straight_quotes, apostrophe, hyphen_as_dash, dash_spacing, three_dots, number_unit_space, number_unit_missing_space, abbreviation_space, thousands_grouping, empty_paragraph, double_paragraph_break, tab_as_indent, trailing_space); line rules run on the composed lines of every text frame like get_frame_lines (widow – Hurenkind, error; orphan – Schusterjunge, warning; heading_at_column_end; single_word_last_line; hyphen_ladder with max_consecutive_hyphens, default 3; empty_line_at_column_start; column_first_baselines_differ, more than 0.1 mm). locale de (default), de-CH (guillemets) or en (curly quotes, closed em dash, no space before %). scope document (default), frame or story (both need frame_id). rules[] limits to those ids, exclude_rules[] drops some; unknown ids are invalid_argument. Returns findings[] {rule_id, severity, category, message, story_id, frame_id, page_id, page_name, start_index, end_index (story indices for the *_to_range tools), snippet, suggestion (often a find_replace GREP pattern)}, counts per rule_id, rules_checked[], rules_failed[] (a GREP pattern InDesign rejected – warning, the rest runs), frames_checked, findings_dropped and truncated (max_findings caps only findings[]; every rule still runs and counts stays complete). Sources: Forssman/de Jong (Detailtypografie), Duden (Satz und Korrektur), DIN 5008, Bier (typokurz), Bringhurst (locale en). Not checked: spelling, grammar, content, text inside placed graphics; table cells are skipped in this version (warning tables_skipped). Read-only.

Parameters (12)
document_idinteger
Document to act on, from list_documents or open_document. Without it the frontmost document is used. A document opened with show_window false is never the active one and must always be addressed by id.
scopestring
document (default), frame (only the frame) or story (all frames of its story); frame and story need frame_id. (values: "document", "frame", "story")
frame_idinteger
Object id of a text frame for scope frame or story.
localestring
Rule language: de (default), de-CH or en. (values: "de", "de-CH", "en")
rulesarray of string
Rule ids to check. Default: every rule of the locale. (max. 100 items)
exclude_rulesarray of string
Rule ids to skip. (max. 100 items)
include_master_pagesboolean
Also check master pages. Default false.
include_locked_layersboolean
Also check frames on locked layers. Default false.
max_findingsinteger
Cap for findings[]. Default 500. (≥ 1, ≤ 2000)
severity_minstring
Report only findings of this severity or above. Default info. (values: "info", "warning", "error")
max_consecutive_hyphensinteger
hyphen_ladder: allowed consecutive hyphenated lines. Default 3 (Forssman/de Jong). (≥ 1, ≤ 10)
min_last_line_charsinteger
single_word_last_line: also report last lines shorter than this many characters. Default 0 = single words only. (≥ 0, ≤ 100)

↑ Top

Last updated: September 2026.

Adobe® and InDesign® are either registered trademarks or trademarks of Adobe in the United States and/or other countries. Mac®, macOS® and Apple Pay® are trademarks of Apple Inc. Microsoft, Windows® and PowerShell are trademarks of the Microsoft group of companies. Google Pay and YouTube are trademarks of Google LLC. Node.js is a trademark of the OpenJS Foundation. Claude is a name of Anthropic. Cursor, Codex, Polar, npm and all other product and company names mentioned are trademarks or names of their respective owners. All references serve solely to describe compatibility and distribution channels; there is no affiliation with, and no endorsement or sponsorship by, these companies.