Adobe InDesign CS (3.0) Object Model JS: Document

InDesign CS

Class

Document

 A document.

QuickLinks

autoStyle, autoTag, close, createTOC, deleteUnusedTags, exportFile, extractLabel, importDtd, importStyles, importXML, insertLabel, loadXMLTags, packageForGoLive, packageForPrint, print, redo, save, saveXMLTags, search, select, undo

Hierarchy

Application
Document
Bookmark | Button | ButtonPreference | CharacterStyle | Color | DTD | DashedStrokeStyle | DataMerge | DictionaryPreference | DocumentPreference | DottedStrokeStyle | Font | FormField | GalleyPreference | Gradient | GraphicLine | GridPreference | Group | Guide | GuidePreference | Hyperlink | HyperlinkExternalPageDestination | HyperlinkPageDestination | HyperlinkPageItemSource | HyperlinkTextDestination | HyperlinkTextSource | HyperlinkURLDestination | HyphenationException | Index | IndexOptions | Ink | Language | Layer | LayoutAdjustmentPreference | LayoutWindow | MarginPreference | MasterSpread | MetadataPreference | MixedInk | MixedInkGroup | Oval | PackageForGoLivePreference | Page | PageItem | ParagraphStyle | PasteboardPreference | Polygon | PolygonPreference | PrintPreference | Rectangle | Section | Spread | Story | StoryPreference | StoryWindow | StripedStrokeStyle | StrokeStyle | Swatch | TOCStyle | TextDefault | TextFrame | TextFramePreference | TextPreference | Tint | TransparencyPreference | TrapPreset | ValidationError | ViewPreference | Window | XMLComment | XMLElement | XMLExportMap | XMLExportPreference | XMLImportMap | XMLImportPreference | XMLInstruction | XMLItem | XMLTag | XMLViewPreference

Properties

PropertyTypeAccessDescription
afterBlendingIntentRenderingIntent:
RenderingIntent.USE_COLOR_SETTINGS
RenderingIntent.PERCEPTUAL
RenderingIntent.SATURATION
RenderingIntent.RELATIVE_COLORIMETRIC
RenderingIntent.ABSOLUTE_COLORIMETRIC
r/wThe rendering intent for colors that result from transparency interactions on the page after blending.
allGraphics Array of Graphic readonlyLists all graphics contained by the Document.
allPageItems Array of PageItem readonlyLists all page items contained by the Document.
associatedXMLElementXMLElement readonlyReturns the associated XML element
bookmarksBookmarks readonlyA collection of bookmarks.
buttonPreferencesButtonPreference readonlyButton preference settings.
buttonsButtons readonlyA collection of buttons.
characterStylesCharacterStyles readonlyA collection of character styles.
cmykProfilestring r/wThe current CMYK profile.
cmykProfileList Array of string readonlyA list of valid CMYK profiles.
colorsColors readonlyA collection of colors.
dashedStrokeStylesDashedStrokeStyles readonlyA collection of dashed stroke styles.
dataMergePropertiesDataMerge readonlyData merge properties that define data merge fields and preferences.
defaultImageIntentRenderingIntent:
RenderingIntent.USE_COLOR_SETTINGS
RenderingIntent.PERCEPTUAL
RenderingIntent.SATURATION
RenderingIntent.RELATIVE_COLORIMETRIC
RenderingIntent.ABSOLUTE_COLORIMETRIC
r/wThe rendering intent for bitmap images.
dictionaryPreferencesDictionaryPreference readonlyUser dictionary preference settings.
documentPreferencesDocumentPreference readonlyDocument preference settings.
dottedStrokeStylesDottedStrokeStyles readonlyA collection of dotted stroke styles.
dtdsDTDs readonlyA collection of DTDs.
filePathFile readonlyThe full path to the file.
fontsFonts readonlyA collection of fonts.
formFieldsFormFields readonlyA collection of form fields.
fullNameFile readonlyThe full path to the Document, including the name of the Document.
galleyPreferencesGalleyPreference readonlyGalley preference settings.
gradientsGradients readonlyA collection of gradients.
graphicLinesGraphicLines readonlyA collection of graphic lines.
gridPreferencesGridPreference readonlyGrid preference settings.
groupsGroups readonlyA collection of groups.
guidePreferencesGuidePreference readonlyGuide preference settings.
guidesGuides readonlyA collection of guides.
hyperlinkExternalPageDestinationsHyperlinkExternalPageDestinations readonlyA collection of hyperlink external page destinations.
hyperlinkPageDestinationsHyperlinkPageDestinations readonlyA collection of hyperlink page destinations.
hyperlinkPageItemSourcesHyperlinkPageItemSources readonlyA collection of hyperlink page item sources.
hyperlinkTextDestinationsHyperlinkTextDestinations readonlyA collection of hyperlink text destinations.
hyperlinkTextSourcesHyperlinkTextSources readonlyA collection of hyperlink text sources.
hyperlinkURLDestinationsHyperlinkURLDestinations readonlyA collection of hyperlink URL destinations.
hyperlinksHyperlinks readonlyA collection of hyperlinks.
hyphenationExceptionsHyphenationExceptions readonlyA collection of hyphenation exceptions lists.
indexnumber readonlyThe index of the Document within its containing object.
indexGenerationOptionsIndexOptions readonlyThe index options properties that define how an index is formatted.
indexesIndexes readonlyA collection of indexes.
inksInks readonlyA collection of inks.
labelstring r/wA property that can be set to any string.
languagesLanguages readonlyA collection of languages.
layersLayers readonlyA collection of layers.
layoutAdjustmentPreferencesLayoutAdjustmentPreference readonlyLayout sdjustment preference settings.
layoutWindowsLayoutWindows readonlyA collection of layout windows.
linksLinks readonlyA collection of links.
marginPreferencesMarginPreference readonlyMargin preference settings.
masterSpreadsMasterSpreads readonlyA collection of master spreads.
metadataPreferencesMetadataPreference readonlyMetadata preference settings.
mixedInkGroupsMixedInkGroups readonlyA collection of mixed ink groups.
mixedInksMixedInks readonlyA collection of mixed inks.
modifiedbool readonlyIf true, the Document has been modified since it was last saved.
namestring readonlyThe name of the Document.
ovalsOvals readonlyA collection of ellipses.
packageForGoLivePreferencesPackageForGoLivePreference readonlyThe Package For GoLive preference properties that define how a document is packaged for GoLive.
pageItemsPageItems readonlyThe page items collection, which can be used to process all page items in a container (such as a document, page, or group), regardless of type.
pagesPages readonlyA collection of pages.
paragraphStylesParagraphStyles readonlyA collection of paragraph styles.
parentApplication readonlyThe parent of the Document (a Application).
pasteboardPreferencesPasteboardPreference readonlyPasteboard preference settings.
polygonPreferencesPolygonPreference readonlyPolygon preference properties to use to define default settings for creating a polygon.
polygonsPolygons readonlyA collection of polygons.
printPreferencesPrintPreference readonlyPrint preference settings.
propertiesObject r/wA property that allows setting of several properties at the same time.
rectanglesRectangles readonlyA collection of rectangles.
redoNamestring readonlyThe name of the action on the top of the redo stack.
rgbProfilestring r/wThe current RGB profile.
rgbProfileList Array of string readonlyA list of valid RGB profiles.
savedbool readonlyIf true, the Document has been saved since it was created.
sectionsSections readonlyA collection of sections.
selection Array of Objects
NothingEnum
Object
r/wThe selection. Can return: Object, Array of Objects or NothingEnum enumerator.
solidColorIntentRenderingIntent:
RenderingIntent.USE_COLOR_SETTINGS
RenderingIntent.PERCEPTUAL
RenderingIntent.SATURATION
RenderingIntent.RELATIVE_COLORIMETRIC
RenderingIntent.ABSOLUTE_COLORIMETRIC
r/wThe rendering intent for all vector art (areas of solid color) in native objects.
spreadsSpreads readonlyA collection of spreads.
storiesStories readonlyA collection of stories.
storyPreferencesStoryPreference readonlyStory preference settings.
storyWindowsStoryWindows readonlyA collection of story windows.
stripedStrokeStylesStripedStrokeStyles readonlyA collection of striped stroke styles.
strokeStylesStrokeStyles readonlyA collection of stroke styles.
swatchesSwatches readonlyA collection of swatches.
textDefaultsTextDefault readonlyText default settings.
textFramePreferencesTextFramePreference readonlyText frame preference settings.
textFramesTextFrames readonlyA collection of text frames.
textPreferencesTextPreference readonlyText preference settings.
tintsTints readonlyA collection of tints.
tocStylesTOCStyles readonlyA collection of TOC styles.
transparencyPreferencesTransparencyPreference readonlyTransparency preference settings.
trapPresetsTrapPresets readonlyA collection of trap presets.
undoNamestring readonlyThe name of the action on the top of the undo stack.
unusedSwatches Array of Swatch readonlyThe swatches that are not being used.
validationErrorsValidationErrors readonlyA collection of XML validation errors.
viewPreferencesViewPreference readonlyView preference settings.
visiblebool readonlyIf true, the Document is visible.
windowsWindows readonlyA collection of windows.
xmlCommentsXMLComments readonlyA collection of XML comments.
xmlElementsXMLElements readonlyA collection of XML elements.
xmlExportMapsXMLExportMaps readonlyA collection of XML export maps.
xmlExportPreferencesXMLExportPreference readonlyXML export preference settings.
xmlImportMapsXMLImportMaps readonlyA collection of XML import maps.
xmlImportPreferencesXMLImportPreference readonlyXML import preference settings.
xmlInstructionsXMLInstructions readonlyA collection of XML instructions.
xmlItemsXMLItems readonlyA collection of XML items.
xmlTagsXMLTags readonlyA collection of XML tags.
xmlViewPreferencesXMLViewPreference readonlyXML view preference settings.
zeroPoint Array of Measurement Unit (Number or String) r/wThe ruler origin, specified as page coordinates in the format [x, y].

Methods

Instances

void autoStyle ()
Auto styles the document based on the tag-to-style map.

void autoTag ()
Auto tags the document based on the style-to-tag map.

void close ([saving: SaveOptions=SaveOptions.ASK][, savingIn: File])
Closes the Document.

ParameterTypeDescription
savingSaveOptions:
SaveOptions.NO
SaveOptions.ASK
SaveOptions.YES
The option for saving changes. (Optional) (default: SaveOptions.ASK)
savingInFileThe file path of the saved document. Note: Required only when saving the document for the first time. If the document has previously been saved, specifying a path saves a copy and closes the original document. (Optional)

TextFrame createTOC (using: TOCStyle[, replacing: bool=false][, fromBook: Book][, placePoint: Array of Measurement Unit (Number or String)][, includeOverset: bool=false][, destinationLayer: Layer])
Create a table of contents for a document or book

ParameterTypeDescription
usingTOCStyleThe table of content style to use
replacingboolWhether to replace the existing TOC (Optional) (default: false)
fromBookBookThe book from which to create the TOC (Optional)
placePoint Array of Measurement Unit (Number or String)The point at which to place the TOC (Optional)
includeOversetboolWhether to include overset text in the TOC (Optional) (default: false)
destinationLayerLayerThe layer on which to place the TOC (Optional)

void deleteUnusedTags ()
Deletes unused XML markup tags.

void exportFile (format: any, to: File[, showingOptions: bool=false][, using: PDFExportPreset])
Exports the object(s) to a file.

ParameterTypeDescription
formatExportFormat
String
The export format. Can accept: ExportFormat enumerator or String.
toFileThe path of the export file.
showingOptionsboolIf true, prompts the user to select export options. (Optional) (default: false)
usingPDFExportPresetThe export style to use. (Optional)

string extractLabel (key: string)
Gets the label value associated with the specified key.

ParameterTypeDescription
keystringThe key.

void importDtd (from: File)
Imports a DTD to use for validation.

ParameterTypeDescription
fromFileThe path to the DTD file.

void importStyles (format: ImportFormat, from: File)
Import styles.

ParameterTypeDescription
formatImportFormat:
ImportFormat.CHARACTER_STYLES_FORMAT
ImportFormat.PARAGRAPH_STYLES_FORMAT
ImportFormat.TEXT_STYLES_FORMAT
ImportFormat.TOC_STYLES_FORMAT
The type of styles to import.
fromFilean InDesign file to import from

void importXML (from: File)
Imports an XML file.

ParameterTypeDescription
fromFileThe path to the XML file.

void insertLabel (key: string, value: string)
Sets the label to the value associated with the specified key.

ParameterTypeDescription
keystringThe key.
valuestringThe value.

void loadXMLTags (from: File)
Loads a set of XML markup tags from the specified file.

ParameterTypeDescription
fromFileThe path to the file that contains the tags.

bool packageForGoLive (location: File)
Packages for GoLive

ParameterTypeDescription
locationFileFile location for package

bool packageForPrint (to: File, copyingFonts: bool, copyingLinkedGraphics: bool, copyingProfiles: bool, updatingGraphics: bool, includingHiddenLayers: bool, ignorePreflightErrors: bool, creatingReport: bool)
Packages the document for handoff to a service provider.

ParameterTypeDescription
toFileThe folder, alias, or path in which to place the packaged files.
copyingFontsboolIf true, copies fonts used in the document to the package folder.
copyingLinkedGraphicsboolIf true, copies linked graphics files to the package folder.
copyingProfilesboolIf true, copies color profiles to the package folder.
updatingGraphicsboolIf true, updates graphics links to the package folder.
includingHiddenLayersboolIf true, copies fonts and links from hidden layers to the package.
ignorePreflightErrorsboolIf true, ignores preflight errors and proceeds with the packaging. If false, cancels the packaging when errors exist.
creatingReportboolIf true, creates a package report that includes printing instructions, print settings, lists of fonts, links and required inks, and other information.

void print ([printDialog: bool][, using: any])
Prints the Document(s).

ParameterTypeDescription
printDialogboolWhether to invoke the print dialog (Optional)
usingPrinterPreset
PrinterPresetTypes
Printer preset to use. Can accept: PrinterPresetTypes enumerator or PrinterPreset. (Optional)

void redo ()
Redoes the last action.

void save ([to: File][, stationery: bool=false])
Save the document

ParameterTypeDescription
toFileThe file path. Note: Required only if the document has not been previously saved. If the document has previously been saved, specifying a path saves a copy and closes the original document. (Optional)
stationeryboolIf true, saves the file as stationery (Mac OS) or as a template (Windows). Note: The file extension for stationery and templates is different than the extension for regular files. (Optional) (default: false)

void saveXMLTags (to: File)
Saves the XML markup tags as an XML file.

ParameterTypeDescription
toFileThe name and location of the XML file.

Array of Text search ([for: string][, wholeWord: bool][, caseSensitive: bool][, replacingWith: string][, withFindAttributes: Object][, withChangeAttributes: Object])
Look for occurrences of text that matches specific criteria

ParameterTypeDescription
forstringWhat to look for (Optional)
wholeWordboolIf true, then disregard text embedded within a larger word (Optional)
caseSensitiveboolIf true, then search only for text that matches case (Optional)
replacingWithstringWhat to replace the found text with, either a string or a special character (Optional)
withFindAttributesObjectA record of find preference settings to use (Optional)
withChangeAttributesObjectA record of change preference settings to use (Optional)

void select (selectableItems: any[, existingSelection: SelectionOptions=SelectionOptions.REPLACE])
Select one or more objects.

ParameterTypeDescription
selectableItems Array of Objects
NothingEnum
Object
The object(s) to select. Can accept: Object, Array of Objects or NothingEnum enumerator.
existingSelectionSelectionOptions:
SelectionOptions.ADD_TO
SelectionOptions.REMOVE_FROM
SelectionOptions.REPLACE
How to handle the existing selection (Optional) (default: SelectionOptions.REPLACE)

void undo ()
Undoes the last action.

Element of

Application.activeDocument

Book.styleSourceDocument

Bookmark.parent

ButtonPreference.parent

CharacterStyle.parent

Color.parent

DashedStrokeStyle.parent

DataMerge.parent

DictionaryPreference.parent

DocumentPreference.parent

DottedStrokeStyle.parent

Font.parent

GalleyPreference.parent

Gradient.parent

GridPreference.parent

GuidePreference.parent

Hyperlink.parent

HyperlinkExternalPageDestination.parent

HyperlinkPageDestination.parent

HyperlinkPageItemSource.parent

HyperlinkTextDestination.parent

HyperlinkTextSource.parent

HyperlinkURLDestination.parent

HyphenationException.parent

Index.parent

IndexOptions.parent

Ink.parent

Language.parent

Layer.parent

LayoutAdjustmentPreference.parent

LayoutWindow.parent

MarginPreference.parent

MasterSpread.parent

MetadataPreference.parent

MixedInk.parent

MixedInkGroup.parent

PackageForGoLivePreference.parent

Page.parent

ParagraphStyle.parent

PasteboardPreference.parent

PolygonPreference.parent

PrintPreference.parent

Section.parent

Spread.parent

Story.parent

StoryPreference.parent

StoryWindow.parent

StripedStrokeStyle.parent

StrokeStyle.parent

Swatch.parent

TOCStyle.parent

TextDefault.parent

TextFramePreference.parent

TextPreference.parent

Tint.parent

TransparencyPreference.parent

TrapPreset.parent

ValidationError.parent

ViewPreference.parent

Window.parent

XMLExportMap.parent

XMLExportPreference.parent

XMLImportMap.parent

XMLImportPreference.parent

XMLTag.parent

XMLViewPreference.parent

Used in:

array of any Asset.placeAsset (on: Document)

Bookmark Bookmark.move ([to: LocationOptions=LocationOptions.AT_END][, reference: any])

Button Buttons.add ([layer: Layer][, at: LocationOptions=LocationOptions.UNKNOWN][, reference: any][, withProperties: Object])

GraphicLine GraphicLines.add ([layer: Layer][, at: LocationOptions=LocationOptions.UNKNOWN][, reference: any][, withProperties: Object])

Group Groups.add (groupItems: Array of PageItem[, layer: Layer][, at: LocationOptions=LocationOptions.UNKNOWN][, reference: any][, withProperties: Object])

Movie Movies.add ([layer: Layer][, at: LocationOptions=LocationOptions.UNKNOWN][, reference: any][, withProperties: Object])

Oval Ovals.add ([layer: Layer][, at: LocationOptions=LocationOptions.UNKNOWN][, reference: any][, withProperties: Object])

Page Pages.add ([at: LocationOptions=LocationOptions.UNKNOWN][, reference: any][, withProperties: Object])

Polygon Polygons.add ([layer: Layer][, numberOfSides: number][, insetPercentage: number][, at: LocationOptions=LocationOptions.UNKNOWN][, reference: any][, withProperties: Object])

Rectangle Rectangles.add ([layer: Layer][, at: LocationOptions=LocationOptions.UNKNOWN][, reference: any][, withProperties: Object])

Section Sections.add ([at: LocationOptions=LocationOptions.UNKNOWN][, reference: any][, withProperties: Object])

Sound Sounds.add ([layer: Layer][, at: LocationOptions=LocationOptions.UNKNOWN][, reference: any][, withProperties: Object])

Spread Spread.duplicate ([to: LocationOptions=LocationOptions.AT_END][, reference: any])

Spread Spread.move ([to: LocationOptions=LocationOptions.AT_END][, reference: any])

Spread Spreads.add ([at: LocationOptions=LocationOptions.UNKNOWN][, reference: any][, withProperties: Object])

TextFrame TextFrames.add ([layer: Layer][, at: LocationOptions=LocationOptions.UNKNOWN][, reference: any][, withProperties: Object])

Return

Document Documents.add ([showingWindow: bool=true][, documentPreset: DocumentPreset][, withProperties: Object])

Jongware, 27-Jun-2010 v3.0.3dContents :: Index