Illustrator JavaScript Scripting Reference
Illustrator JavaScript Scripting Reference
Illustrator JavaScript Scripting Reference
If this guide is distributed with software that includes an end user agreement, this guide, as well as the software
described in it, is furnished under license and may be used or copied only in accordance with the terms of such license.
Except as permitted by any such license, no part of this guide may be reproduced, stored in a retrieval system, or
transmitted, in any form or by any means, electronic, mechanical, recording, or otherwise, without the prior written
permission of Adobe Systems Incorporated. Please note that the content in this guide is protected under copyright law
even if it is not distributed with software that includes an end user license agreement.
The content of this guide is furnished for informational use only, is subject to change without notice, and should not be
construed as a commitment by Adobe Systems Incorporated. Adobe Systems Incorporated assumes no responsibility or
liability for any errors or inaccuracies that may appear in the informational content contained in this guide.
Please remember that existing artwork or images that you may want to include in your project may be protected under
copyright law. The unauthorized incorporation of such material into your new work could be a violation of the rights of
the copyright owner. Please be sure to obtain any permission required from the copyright owner.
Any references to company names in sample templates are for demonstration purposes only and are not intended to
refer to any actual organization.
Adobe, the Adobe logo, Acrobat, Flash, Illustrator, Macromedia, and Photoshop are either registered trademarks or
trademarks of Adobe Systems Incorporated in the United States and/or other countries.
JavaScript and all Java-related marks are trademarks or registered trademarks of Sun Microsystems, Incorporated in the
United States and other countries.
Adobe Systems Incorporated, 345 Park Avenue, San Jose, California 95110, USA. Notice to U.S. Government End Users.
The Software and Documentation are Commercial Items, as that term is defined at 48 C.F.R. 2.101, consisting of
Commercial Computer Software and Commercial Computer Software Documentation, as such terms are used in 48
C.F.R. 12.212 or 48 C.F.R. 227.7202, as applicable. Consistent with 48 C.F.R. 12.212 or 48 C.F.R. 227.7202-1 through
227.7202-4, as applicable, the Commercial Computer Software and Commercial Computer Software Documentation are
being licensed to U.S. Government end users (a) only as Commercial Items and (b) with only those rights as are granted
to all other end users pursuant to the terms and conditions herein. Unpublished-rights reserved under the copyright
laws of the United States. Adobe Systems Incorporated, 345 Park Avenue, San Jose, CA 95110-2704, USA. For U.S.
Government End Users, Adobe agrees to comply with all applicable equal opportunity laws including, if appropriate, the
provisions of Executive Order 11246, as amended, Section 402 of the Vietnam Era Veterans Readjustment Assistance Act
of 1974 (38 USC 4212), and Section 503 of the Rehabilitation Act of 1973, as amended, and the regulations at 41 CFR
Parts 60-1 through 60-60, 60-250, and 60-741. The affirmative action clause and regulations contained in the preceding
sentence shall be incorporated by reference.
Contents
3
Contents 4
GradientStops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
GraphicStyle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
GraphicStyles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
GraphItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
GraphItems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
GrayColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
GroupItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
GroupItems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
IllustratorSaveOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
ImageCaptureOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Ink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
InkInfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
InsertionPoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
InsertionPoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
LabColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
Layers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
LegacyTextItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
LegacyTextItems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
Matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
MeshItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
MeshItems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
NoColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
NonNativeItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
NonNativeItems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
OpenOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
OpenOptionsAutoCAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
OpenOptionsFreeHand . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
OpenOptionsPhotoshop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
PageItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
PageItems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Paper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
PaperInfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
ParagraphAttributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
Paragraphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
ParagraphStyle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
ParagraphStyles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
Contents 5
PathItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
PathItems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
PathPoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
PathPoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
Pattern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
PatternColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
PDFFileOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
PDFSaveOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
PhotoshopFileOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
PlacedItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
PlacedItems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
PluginItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
PluginItems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
PPDFile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
PPDFileInfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
Preferences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
PrintColorManagementOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
PrintColorSeparationOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
PrintCoordinateOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
Printer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
PrinterInfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
PrintFlattenerOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
PrintFontOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
PrintJobOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
PrintOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
PrintPageMarksOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
PrintPaperOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
PrintPostScriptOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
RasterEffectOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
RasterItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
RasterItems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
RasterizeOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
RGBColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
Screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
ScreenInfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
ScreenSpotFunction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
Spot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
Contents 6
SpotColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
Spots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
Story . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
Stories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
Swatch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
Swatches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
SwatchGroup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
SwatchGroups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
Symbol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
SymbolItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
SymbolItems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
TabStopInfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
Tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
Tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
TextFont . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
TextFonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
TextFrameItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
TextFrameItems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
TextPath . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
TextRange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
TextRanges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
TracingObject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
TracingOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
Words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
This section presents all of the object classes in the type library. Each class listing includes the following:
Properties of the class, including value type, read-only status, and an explanation.
Methods for the class. Constants and value types needed by the method are shown in bold face.
Required terms are shown in plain face. All items surrounded by brackets [ ] are optional.
Sample code to help illustrate the syntax and typical workflow usage of the object class.
These examples are intended to be clear demonstrations of syntax, and do not show the best or most
efficient way to construct a JavaScript script. Error checking, for instance, is generally brief or missing.
However, the examples can be combined and expanded to make scripts with greater functionality.
7
CHAPTER 1: JavaScript Object Reference Application 8
Application
The Adobe Illustrator application object, referenced using the pre-defined global app object, which
contains all other Illustrator objects.
Application properties
Application methods
var newItem;
var docSelected = app.activeDocument.selection;
if ( docSelected.length > 0 ) {
// Create a new document and move the selected items to it.
var newDoc = app.documents.add();
if ( docSelected.length > 0 ) {
for ( i = 0; i < docSelected.length; i++ ) {
docSelected[i].selected = false;
newItem = docSelected[i].duplicate( newDoc,
ElementPlacement.PLACEATEND );
}
}
else {
docSelected.selected = false;
newItem = docSelected.parent.duplicate( newDoc,
ElementPlacement.PLACEATEND );
}
}
else {
alert( "Please select one or more art objects" );
}
CHAPTER 1: JavaScript Object Reference Artboard 13
Artboard
An Artboard object represents a single artboard in a document. There can be between 1 to 100 artboards
in one document.
Artboard properties
Artboards methods
Artboards
A collection of Artboard objects.
Artboards properties
Artboards methods
Brush
A brush in an Illustrator document. Brushes are contained in documents. Additional brushes may be
created by the user within Illustrator. You can access brushes within a script, but you cannot create them.
Brush properties
Brush methods
Applying a brush
// Duplicates and groups all items in the current selection,
// then applies the same brush to each item in the group
if ( app.documents.length > 0 ) {
docSelection = app.activeDocument.selection;
if ( docSelection.length > 0 ) {
newGroup = app.activeDocument.groupItems.add();
Brushes
A collection of brush objects in a document.
Brushes properties
Brushes methods
Counting brushes
// Counts all brushes in the active document
if ( app.documents.length > 0 ) {
numberOfBrushes = app.activeDocument.brushes.length;
}
CHAPTER 1: JavaScript Object Reference CharacterAttributes 17
CharacterAttributes
Specifies the properties of a character contained in a text frame. A CharacterStyle object associates
these attributes with a specific text range through its characterAttributes property.
NOTE: Character attributes do not have default values, and are undefined until explicitly set.
CharacterAttributes properties
Characters
A collection of characters (TextRange objects of length 1). The elements are not named; you must access
them by index.
Characters properties
Characters methods
Counting characters
// Counts all characters in the active document,
// including whitespace, and stores in numChars
if ( app.documents.length > 0 ) {
var doc = app.activeDocument;
var numChars = 0;
for ( i = 0; i < doc.textFrames.length; i++ ) {
textArtRange = doc.textFrames[i].contents;
numChars += textArtRange.length;
}
}
CHAPTER 1: JavaScript Object Reference CharacterStyle 22
CharacterStyle
Associates character attributes with characters. For an example, see CharacterStyles.
CharacterStyle properties
CharacterStyle methods
CharacterStyles
A collection of CharacterStyle objects.
CharacterStyles properties
CharacterStyles methods
getByName CharacterStyle Gets the first element in the collection with the
(name) string provided name.
index CharacterStyle Gets an element from the collection.
(itemKey) string, number
CMYKColor
A CMYK color specification, used where a color object is required.
If the color space of a document is RGB and you specify the color value for a page item in that document
using CMYK, Illustrator will translate the CMYK color specification into an RGB color specification. The same
thing happens if the documents color space is CMYK and you specify colors using RGB. Since this
translation can lose information, you should specify colors using the class that matches the documents
actual color space.
CMYKColor properties
Color
An abstract parent class for all color classes used in Illustrator. Subclasses are:
CMYKColor
GradientColor
GrayColor
LabColor
NoColor
PatternColor
RGBColor
SpotColor
CHAPTER 1: JavaScript Object Reference CompoundPathItem 27
CompoundPathItem
A compound path. These objects are composed of multiple intersecting paths, resulting in transparent
interior spaces where the component paths overlap. The pathItems property provides access to the paths
that make up the compound path.
Paths contained within a compound path or group in a document are returned as individual paths when a
script asks for the paths contained in the document. However, paths contained in a compound path or
group are not returned when a script asks for the paths in a layer that contains the compound path or
group.
All paths within a compound path share property values. Therefore, if you set the value of a property of
any one of the paths in the compound path, the properties of all other component paths are updated with
the new value.
CompoundPathItem properties
pathItems PathItems Read-only. The path art items in this compound path.
CHAPTER 1: JavaScript Object Reference CompoundPathItem 28
CompoundPathItem methods
if ( app.documents.length > 0 ) {
doc = app.activeDocument;
count = 0;
if ( doc.pathItems.length > 0 ) {
thePaths = doc.pathItems;
numPaths = thePaths.length;
for ( i = 0; i < doc.pathItems.length; i++ ) {
pathArt = doc.pathItems[i];
if ( pathArt.parent.typename != "CompoundPathItem" ) {
pathArt.selected = true;
count++;
}
}
}
}
if ( app.documents.length > 0 ) {
doc = app.activeDocument;
newCompoundPath = doc.activeLayer.compoundPathItems.add();
newPath = newCompoundPath.pathItems.add();
newPath.setEntirePath( Array( Array(40, 100), Array(100, 100) ) );
newPath = newCompoundPath.pathItems.add();
newPath.setEntirePath( Array( Array(100, 110), Array(100, 300) ) );
CompoundPathItems
A collection of CompoundPathItem objects.
CompoundPathItem methods
CompoundPathItem methods
if ( app.documents.length > 0 ) {
doc = app.activeDocument;
numCompoundPaths = doc.layers[0].compoundPathItems.length;
}
CHAPTER 1: JavaScript Object Reference Dataset 32
Dataset
A set of data used for dynamic publishing. A dataset allows you to collect a number of variables and their
dynamic data into one object. You must have at least one variable bound to an art item in order to create a
dataset. See the class Variable.
Dataset properties
Dataset methods
textRef.contentVariable = textVar;
redraw();
// Create dataset 1
var ds1 = docRef.dataSets.add();
Datasets
A collection of Dataset objects.
Datasets properties
Datasets methods
getByName Dataset Gets the first element in the collection with the
(name) string specified name.
index Dataset Gets an element from the collection.
(itemKey) string, number
Document
An Illustrator document. Documents are contained in the Application object.
The default document settingsthose properties starting with the word defaultare global settings
that affect the current document. Be sure to modify these default properties only when a document is
open. Note that if you set default properties to desired values before creating new objects, you can
streamline your scripts, eliminating the need to specify specific properties such as fillColor and
stroked that have default properties.
A documents color space, height, and width can only be set when the document is created. You cannot
modify these properties in an existing document. See Application.open for more information on how
document color spaces are handled.
Document properties
Document methods
docRef.selection = null;
Closing a document
// Closes the active document without saving changes
if ( app.documents.length > 0 ) {
aiDocument = app.activeDocument;
aiDocument.close( SaveOptions.DONOTSAVECHANGES );
aiDocument = null;
}
CHAPTER 1: JavaScript Object Reference Document 43
if ( app.documents.length == 0 ) {
doc = app.documents.add();
}
else {
doc = app.activeDocument;
}
doc.defaultFilled = true;
doc.defaultStroked = true;
CHAPTER 1: JavaScript Object Reference DocumentPreset 44
DocumentPreset
A preset document template to use when creating a new document. See Documents.addDocument().
DocumentPreset properties
Documents
A collection of Document objects.
Documents properties
Documents methods
app.documents.add( DocumentColorSpace.RGB );
CHAPTER 1: JavaScript Object Reference EPSSaveOptions 46
EPSSaveOptions
Options for saving a document as an Illustrator EPS file, used with the saveAs method. All properties are
optional.
EPSSaveOptions properties
ExportOptionsAutoCAD
Options for exporting a document as an AutoCAD file, used with the exportFile method. All properties are
optional.
When you export a document, a file extension is appended automatically. You should not include any file
extension in the file specification. To override the default AutoCAD export format (DWG), use the
exportFileFormat property.
ExportOptionsAutoCAD properties
ExportOptionsFlash
Options for exporting a document as a Macromedia Flash (SWF) file, used with the exportFile method.
All properties are optional.
When you export a document, the appropriate file extension is appended automatically. You should not
include any file extension in the file specification.
ExportOptionsFlash properties
function exportToFlashFile(destFile) {
if ( app.documents.length > 0 ) {
var exportOptions = new ExportOptionsFlash();
var type = ExportType.FLASH;
var fileSpec = new File(destFile);
exportOptions.resolution = 150;
app.activeDocument.exportFile( fileSpec, type, exportOptions );
}
}
CHAPTER 1: JavaScript Object Reference ExportOptionsGIF 52
ExportOptionsGIF
Options for exporting a document as a GIF file, used with the exportFile method. All properties are
optional.
When you export a document, the appropriate file extension is appended automatically. You should not
include any file extension in the file specification.
ExportOptionsGIF properties
function exportToGIFFile(dest) {
if ( app.documents.length > 0 ) {
var exportOptions = new ExportOptionsGIF();
var type = ExportType.GIF;
var fileSpec = new File(dest);
exportOptions.antiAliasing = false;
exportOptions.colorCount = 64;
exportOptions.colorDither = ColorDitherMethod.DIFFUSION;
ExportOptionsJPEG
Options for exporting a document as a JPEG file, used with the exportFile method. All properties are
optional.
When you export a document, the appropriate file extension is appended automatically. You should not
include any file extension in the file specification.
ExportOptionsJPEG properties
ExportOptionsPhotoshop
Options for exporting a document as a Photoshop file, used with the exportFile method. All properties are
optional.
When you export a document, the appropriate file extension is appended automatically. You should not
include any file extension in the file specification.
ExportOptionsPhotoshop properties
ExportOptionsPNG8
Options for exporting a document as an 8-bit PNG file, used with the exportFile method. All properties are
optional.
When you export a document, the appropriate file extension is appended automatically. You should not
include any file extension in the file specification.
ExportOptionsPNG8 properties
ExportOptionsPNG24
Options for exporting a document as a 24-bit PNG file, used with the exportFile method. All properties are
optional.
When you export a document, the appropriate file extension is appended automatically. You should not
include any file extension in the file specification.
ExportOptionsPNG24 properties
ExportOptionsSVG
Options for exporting a document as a SVG file, used with the exportFile method. All properties are
optional.
When you export a document, the appropriate file extension is appended automatically. You should not
include any file extension in the file specification.
ExportOptionsSVG properties
ExportOptionsTIFF
Options for exporting a document as a TIFF file, used with the exportFile method. All properties are
optional.
When you export a document, the appropriate file extension is appended automatically. You should not
include any file extension in the file specification.
ExportOptionsTIFF properties
FXGSaveOptions
Specifies options which may be supplied when saving a document as an FXG file. All properties are
optional.
FXGSaveOptions properties
Gradient
A gradient definition contained in a document. Scripts can create new gradients.
Gradient properties
Gradient methods
if ( app.documents.length > 0 ) {
// Create a color for both ends of the gradient
var startColor = new RGBColor();
var endColor = new RGBColor();
startColor.red = 0;
startColor.green = 100;
startColor.blue = 255;
endColor.red = 220;
endColor.green = 0;
endColor.blue = 100;
GradientColor
A gradient color specification in a Gradient object. A script can create a new gradient color using a
reference to an existing gradient in the document. If no existing gradient object is referenced, a default
gradient is supplied.
GradientColor properties
app.documents.add(DocumentColorSpace.RGB);
Gradients
A collection of Gradient objects in a document.
Gradients properties
Gradients methods
getByName Gradient Gets the first element in the collection with the
(name) string specified name.
index Gradient Gets an element from the collection.
(itemKey) string, number
Removing a gradient
// Deletes the first gradient from the current document
if ( app.documents.length > 0 ) {
app.activeDocument.gradients[0].remove();
}
CHAPTER 1: JavaScript Object Reference GradientStop 69
GradientStop
A gradient stop definition that represents a point on a specific gradient defined in the document. Each
gradient stop specifies a color change in the containing gradient. See Changing a gradient stop color for
an example.
GradientStop properties
GradientStop methods
GradientStops
A collection of GradientStop objects in a specific gradient. The elements are not named; you must access
them by index.
GradientStops properties
GradientStops methods
}
CHAPTER 1: JavaScript Object Reference GraphicStyle 72
GraphicStyle
A graphic style. Each graphic style defines a set of appearance attributes that you can apply
non-destructively to page items. Graphic styles are contained in documents. Scripts cannot create new
graphic styles.
GraphicStyle properties
GraphicStyle methods
if ( app.documents.length > 0 ) {
var doc = app.activeDocument;
var selected = doc.selection;
GraphicStyles
A collection of GraphicStyle objects in a document.
GraphicStyles properties
GraphicStyles methods
if ( app.documents.length > 0 ) {
var numberOfStyles = app.activeDocument.graphicStyles.length;
}
CHAPTER 1: JavaScript Object Reference GraphItem 74
GraphItem
Any graph artwork object. See example Rotating graph items below.
GraphItem properties
position array of 2 numbers The position (in points) of the top left corner of the
graphItem object in the format [x, y]. Does not
include stroke weight.
selected boolean If true, this object is selected.
sliced boolean If true, the graph item is sliced. Default: false
CHAPTER 1: JavaScript Object Reference GraphItem 75
GraphItem methods
GraphItems
A collection GraphItems objects, which gives you access to all the graph art items in an Illustrator
document.
GraphItems properties
GraphItems methods
GrayColor
A grayscale color specification, used where a color object is required.
GrayColor properties
if ( app.documents.length > 0
&& app.activeDocument.textFrames.length > 0 ) {
var text = app.activeDocument.textFrames[0].textRange;
var firstWord = text.words[0];
GroupItem
A grouped set of art items. Group items can contain all of the same page items that a layer can contain,
including other nested groups.
Paths contained in a group or compound path in a document are returned as individual paths when a
script asks for the paths contained in the document. However, paths contained in a group or compound
path are not returned when a script asks for the paths in a layer which contains the group or compound
path.
GroupItem properties
GroupItem methods
It is easy to modify all of the objects contained in a group. This example demonstrates how to simplify your
operations on multiple objects by creating group to contain them.
// Creates a new group item, adds a new path item, of triangle shape, to the group, then
// adds a new text item to the group and sets the fill color of the text to red
if ( app.documents.length > 0 ) {
var triangleGroup = app.activeDocument.groupItems.add();
// Create a triangle and add text, the new art is created inside the group
var trianglePath = triangleGroup.pathItems.add();
trianglePath.setEntirePath( Array( Array(100, 100), Array(300, 100),
Array(200, Math.tan(1.0471975) * 100 + 100) ) );
trianglePath.closed = true;
trianglePath.stroked = true;
trianglePath.filled = false;
trianglePath.strokeWidth = 3;
GroupItems
The collection of grouped art items in a document.
GroupItems properties
GroupItems methods
The following script shows how you can import a PDF document using the createFromFile function.
Before running this script you must create a one page PDF file and put it in the location
/temp/testfile1.pdf.
function embedPDF(dest) {
var embedDoc = new File(dest);
if ( app.documents.length > 0 && embedDoc.exists ) {
var doc = app.activeDocument;
var placed = doc.groupItems.createFromFile( embedDoc );
}
}
CHAPTER 1: JavaScript Object Reference IllustratorSaveOptions 84
IllustratorSaveOptions
Options for saving a document as an Illustrator file, used with the saveAs method. All properties are
optional.
IllustratorSaveOptions properties
ImageCaptureOptions
Options for image capture, used with the imageCapture method. All properties are optional.
ImageCaptureOptions properties
Ink
Associates a document ink name with ink information.
Ink properties
InkInfo
Ink information for printing a document.
InkInfo properties
InsertionPoint
A location between characters that is used to insert new text objects. An insertion point is contained in an
InsertionPoints collection.
InsertionPoint properties
InsertionPoints
A collection of InsertionPoint objects.
InsertionPoints properties
InsertionPoints methods
LabColor
A color specification in the CIE Lab color space, used where a color object is required.
LabColor properties
Layer
A layer in an Illustrator document. Layers may contain nested layers, which are called sublayers in the user
interface.
The layer object contains all of the page items in the specific layer as elements. Your script can access
page items as elements of either the Layer object or as elements of the Document object. When accessing
page items as elements of a layer, only objects in that layer can be accessed. To access page items
throughout the entire document, be sure to refer to them as contained by the document.
Layer properties
Layer methods
if (documents.length > 0) {
countOfLayers = activeDocument.layers.length;
if (countOfLayers > 1) {
bottomLayer = activeDocument.layers[countOfLayers-1];
bottomLayer.zOrder(ZOrderMethod.BRINGTOFRONT);
}
else {
alert("The active document only has only 1 layer")
}
}
CHAPTER 1: JavaScript Object Reference Layers 95
Layers
The collection of layers in the document.
Layers properties
Layers methods
getByName Layer Gets the first element in the collection with the specified
(name) string name.
index Layer Gets an element from the collection.
(itemKey) string, number
LegacyTextItem
A text object created in Illustrator CS (version 10) or earlier, which is uneditable until converted. To convert
legacy text, see convertToNative.
You can view, move, and print legacy text, but you cant edit it. Legacy text has an x through its bounding
box when selected.
LegacyTextItem properties
LegacyTextItem methods
LegacyTextItems
A collection of LegacyTextItem objects.
LegacyTextItems properties
LegacyTextItems methods
Lines
A collection of TextRange objects representing lines of text in a text frame. The elements are not named;
you must access them by index.
Lines properties
Lines methods
Matrix
A transformation matrix specification, used to transform the geometry of objects. Use it to specify and
retrieve matrix information from an Illustrator document or from page items in a document.
Matrices are used in conjunction with the transform method and as a property of a number of objects. A
matrix specifies how to transform the geometry of an object. You can generate an original matrix using the
Application object methods getTranslationMatrix, getScaleMatrix, or getRotationMatrix.
A Matrix is a record containing the matrix values, not a reference to a matrix object. The matrix
commands operate on the values of a matrix record. If a command modifies a matrix, a modified matrix
record is returned as the result of the command. The original matrix record passed to the command is not
modified.
Matrix properties
To apply multiple transformations to objects, it is more efficient to use the matrix suite than to apply the
transformations one at a time. The following script demonstrates how to combine multiple matrices.
// Tranforms all art in a document using translation and rotation matrices,
// moves art half an inch to the right and 1.5 inches up on the page
if ( app.documents.length > 0 ) {
var moveMatrix = app.getTranslationMatrix( 0.5, 1.5 );
// Add a rotation to the translation, 10 degrees counter clockwise
var totalMatrix = concatenateRotationMatrix( moveMatrix, 10 );
// apply the transformation to all art in the document
var doc = app.activeDocument;
for ( i = 0; i < doc.pageItems.length; i++ ) {
doc.pageItems[i].transform( totalMatrix );
}
}
CHAPTER 1: JavaScript Object Reference MeshItem 102
MeshItem
A gradient mesh art item. You cannot create mesh items from a script. However, you can copy an existing
mesh item with the duplicate method, then use the one of the move methods to place the copy at the
proper location.
MeshItem properties
position array of 2 numbers The position (in points) of the top left corner of the
meshItem object in the format [x, y]. Does not include
stroke weight.
selected boolean If true, this item is selected.
sliced boolean If true, the item sliced. Default: false
tags Tags Read-only. The tags contained in this item.
top number (double) The position of the top of the item (in points, measured
from the bottom of the page).
CHAPTER 1: JavaScript Object Reference MeshItem 103
MeshItem methods
if ( app.documents.length > 0 ) {
doc = app.activeDocument;
for ( i = 0; i < doc.meshItems.length; i++ ) {
doc.meshItems[i].locked = true;
}
}
CHAPTER 1: JavaScript Object Reference MeshItems 105
MeshItems
A collection of MeshItem objects.
MeshItems properties
MeshItems methods
To run this script, have two open documents. One document should contain at least one mesh item, the
other document can be empty. Make the empty document the frontmost before running the script.
// Copies all mesh items from one document to a new document
if ( app.documents.length > 0 ) {
var srcDoc = documents[0];
var locationOffset = 0;
var targetDoc = documents.add();
NoColor
Represents the none color. Assigning a NoColor object to the fill or stroke color of an art item is
equivalent to setting the filled or stroked property to false.
NoColor properties
NonNativeItem
A non-native artwork item.
NonNativeItem properties
These classes inherit all properties from the page item class.
position array of 2 numbers The position (in points) of the top left corner of the
NonNativeItem object in the format [x, y]. Does not
include stroke weight.
selected boolean If true, this item is selected.
sliced boolean If true, the item sliced. Default: false
tags Tags Read-only. The tags contained in this item.
top number (double) The position of the top of the item (in points, measured
from the bottom of the page).
CHAPTER 1: JavaScript Object Reference NonNativeItem 108
NonNativeItem methods
NonNativeItems
A collection of NonNativeItem objects.
NonNativeItems properties
NonNativeItems methods
OpenOptions
Options for opening a document, used with the open method.
OpenOptions properties
OpenOptionsAutoCAD
Options for opening an AutoCAD drawing, used with the open method.
OpenOptionsAutoCAD properties
OpenOptionsFreeHand
Options for opening a FreeHand file.
OpenOptionsFreeHand properties
OpenOptionsPhotoshop
Options for opening a Photoshop document, used with the open method.
OpenOptionsPhotoshop properties
PageItem
Any art item. Every art item and group in a document is a page item. You may refer to a page item as an
element of a document, layer, or group item.
The PageItem class gives you complete access to every art item contained in an Illustrator document. The
PageItem class is the superclass of all artwork objects in a document. The CompoundPathItem, GroupItem,
MeshItem, PathItem, PlacedItem, PluginItem, RasterItem, and TextFrame classes each inherit a set of
properties from the PageItem class.
You cannot create a PageItem directly, you must create one of the specific PageItem subclasses, such as
PathItem.
PageItem properties
wrapped boolean If true, wrap text frame objects around this object (text
frame must be above the object).
zOrderPosition number (long) Read-only. The drawing order of the art within its group or
layer.
PageItem methods
PageItems
A collection of page item objects. Provides complete access to all the art items in an Illustrator document
in the following classes:
CompoundPathItem
GraphItem
GroupItem
LegacyTextItem
MeshItem
NonNativeItem
PathItem
PlacedItem
PluginItem
RasterItem
SymbolItem
TextFrameItem
You can reference page items through the PageItems property in a Document, Layer, or Group. When you
access an individual item in one of these collections, the reference is a page item of one of a particular
type. For example, if you use PageItems to reference a graph item, the typename value of that object is
GraphItem.
PageItems properties
PageItems methods
Before running this script, open a document that contains one or more linked images.
// Gets all file-references in the current document using the pageItems object,
// then displays them in a new document
if ( app.documents.length > 0 ) {
var fileReferences = new Array();
Paper
Associates paper information with a paper name. Paper objects are used by Printer objects.
Paper properties
PaperInfo
Paper information for use in printing documents.
PaperInfo properties
ParagraphAttributes
Specifies the properties and attributes of a paragraph contained in a text frame.
Note: Paragraph attributes do not have default values, and are undefined until explicitly set.
ParagraphAttributes properties
Paragraphs
A collection of TextRange objects, with each TextRange representing a paragraph. The elements are not
named; you must access them by index.
Paragraphs properties
Paragraphs methods
Counting paragraphs
// Counts all paragraphs in current doc and stores result in paragraphCount
if ( app.documents.length > 0 ) {
doc = app.activeDocument;
paragraphCount = 0;
for ( i = 0; i < doc.textFrames.length; i++ ) {
paragraphCount += doc.textFrames[i].paragraphs.length;
}
}
CHAPTER 1: JavaScript Object Reference ParagraphStyle 127
ParagraphStyle
Associates character and paragraph attributes with a style name. The style object can be used to apply
those attributes to the text in a TextFrame object. See Creating and applying a paragraph style below.
ParagraphStyle properties
ParagraphStyle methods
ParagraphStyles
A collection of ParagraphStyle objects.
ParagraphStyles properties
ParagraphStyles methods
getByName ParagraphStyle Get the first element in the collection with the
(name) string provided name.
index ParagraphStyle Gets an element from the collection.
(itemKey) string, number
PathItem
Specifies a path item, which contains PathPoint objects that define its geometry. The PathItem class
gives you complete access to paths in Illustrator. The setEntirePath method provides an extremely
efficient way to create paths comprised of straight lines.
PathItem properties
PathItem methods
if ( app.documents.length > 0 ) {
var lineList = new Array(10);
for ( i = 0; i < lineList.length; i++ ) {
lineList[i] = new Array( i * 10 + 50, ((i - 5) ^ 2) * 5 +50);
}
app.defaultStroked = true;
newPath = app.activeDocument.pathItems.add();
newPath.setEntirePath(lineList);
}
CHAPTER 1: JavaScript Object Reference PathItems 135
PathItems
A collection of PathItem objects. The methods ellipse, polygon, rectangle, roundedRectangle, and
star allow you to create complex path items using straightforward parameters. If you do not provide any
parameters when calling these methods, default values are used.
PathItems properties
PathItems methods
Creating shapes
// Creates 5 shapes in layer 1 of document 1
// and applies a random graphic style to each
PathPoint
A point on a specific path. Each path point is made up of an anchor point (anchor) and a pair of handles
(leftDirection and rightDirection).
PathPoint properties
PathPoint methods
PathPoints
A collection of PathPoint objects in a specific path. The elements are not named; you must access them
by index.
PathPoints properties
PathPoints methods
if ( app.documents.length > 0 ) {
var doc = app.activeDocument;
var line = doc.pathItems.add();
line.stroked = true;
line.setEntirePath( Array( Array(220, 475), Array(375, 300) ) );
Pattern
An Illustrator pattern definition contained in a document. Patterns are shown in the Swatches palette.
Each pattern is referenced by a PatternColor object, which defines the patterns appearance.
Pattern properties
Pattern methods
PatternColor
A pattern color specification. You can create a new pattern color by modifying an existing pattern in the
document. Any modification you make to a pattern affects that pattern in the Palette.
PatternColor objects can be used in any property that takes a color object, such as fillColor or
strokeColor.
PatternColor properties
Patterns
A collection of Pattern objects in a document.
Patterns properties
Patterns methods
getByName Pattern Gets the first element in the collection with the provided
(name) string name.
index Pattern Gets an element from the collection.
(itemKey) string, number
Removing a pattern
// Deletes the last pattern from the current document.
if ( app.documents.length > 0 ) {
var lastIndex = app.activeDocument.patterns.length - 1;
var patternToRemove = app.activeDocument.patterns[lastIndex];
var patternName = patternToRemove.name;
patternToRemove.remove();
// Note after removing Illustrator objects, set the variable that
// referenced the removed object to null, since it is now invalid.
patternToRemove = null;
}
CHAPTER 1: JavaScript Object Reference PDFFileOptions 143
PDFFileOptions
Options for opening a PDF file, used with the open method. All properties are optional.
PDFFileOptions properties
PDFSaveOptions
Options for saving a document as an Adobe PDF file, used with the saveAs method. All properties are
optional.
PDFSaveOptions properties
PhotoshopFileOptions
Options for opening a Photoshop file, used with the open method. All properties are optional.
PhotoshopFileOptions properties
PlacedItem
An artwork item placed in a document as a linked file. For example, an artwork object created using the
File > Place command in Illustrator or using the add() method of the placedItems collection object is a
placed item. For information, see PlacedItems on page 155.
PlacedItem properties
position array of 2 numbers The position (in points) of the top left corner of the
placedItem object in the format [x, y]. Does not include
stroke weight.
selected boolean If true, this item is selected.
CHAPTER 1: JavaScript Object Reference PlacedItem 152
PlacedItem methods
if ( app.documents.length > 0 ) {
for ( i = 0; i < app.activeDocument.placedItems.length; i++ ) {
placedArt = app.activeDocument.placedItems[i];
placedArt.selected = !(placedArt.selected);
}
}
CHAPTER 1: JavaScript Object Reference PlacedItems 155
PlacedItems
A collection of PlacedItem objects in the document.
PlacedItems properties
PlacedItems methods
PluginItem
An art item created by an Illustrator plug-in. Scripts can create a plug-in item using PlacedItem.trace or
RasterItem.trace, and can copy existing plug-in items using the duplicate method, but cannot create
PluginItem objects directly.
PluginItem properties
PluginItem methods
PluginItems
A collection of PluginItem objects in a document. See Copying a plug-in item.
PluginItems properties
PluginItems methods
PPDFile
Associates file information with a PostScript Printer Description (PPD) file.
PPDFile properties
PPDFileInfo
Information about a PostScript Printer Description (PPD) file.
PPDFileInfo properties
sPPD += "\r\tScreens:\r";
var iScreens = ppdInfoRef.screenList.length;
for(var c=0; c<iScreens; c++) {
var screenRef = ppdInfoRef.screenList[c];
sPPD += "\t\t";
sPPD += screenRef.name;
var screenInfoRef = screenRef.screenInfo;
sPPD += ", Angle = ";
sPPD += screenInfoRef.angle;
sPPD += ", Frequency = ";
sPPD += screenInfoRef.frequency;
sPPD += "\r";
}
sPPD += "\r\tScreenSpots:\r";
var iScreenSpots = ppdInfoRef.screenSpotFunctionList.length;
for(var n=0; n<iScreenSpots; n++) {
var screenSpotRef = ppdInfoRef.screenSpotFunctionList[n];
sPPD += "\t\t";
sPPD += screenSpotRef.name;
sPPD += ", spotFunction: ";
sPPD += screenSpotRef.spotFunction;
sPPD += "\r";
}
y-=(textRef.height);
}
CHAPTER 1: JavaScript Object Reference Preferences 163
Preferences
Specifies the preferred options for AutoCAD, FreeHand, PDF, and Photoshop files.
Preferences properties
Preferences methods
PrintColorManagementOptions
Information used for color management of the document.
PrintColorManagementOptions properties
symbolRef = docRef.symbols[i];
symbolItemRef1 = docRef.symbolItems.add(symbolRef);
symbolItemRef1.top = y;
symbolItemRef1.left = 100;
y -= (symbolItemRef1.height + 10);
}
redraw();
colorOptions.intent = PrintColorIntent.PERCEPTUALINTENT;
docRef.print(options);
colorOptions.intent = PrintColorIntent.RELATIVECOLORIMETRIC;
docRef.print(options);
colorOptions.intent = PrintColorIntent.SATURATIONINTENT;
docRef.print(options);
CHAPTER 1: JavaScript Object Reference PrintColorSeparationOptions 166
PrintColorSeparationOptions
Information about the color separations to be used in printing the document.
PrintColorSeparationOptions properties
sepOptions.convertSpotColors = true;
sepOptions.overPrintBlack = true;
sepOptions.colorSeparationMode = PrintColorSeparationMode.COMPOSITE;
docRef.print(options);
sepOptions.colorSeparationMode = PrintColorSeparationMode.INRIPSEPARATION;
docRef.print(options);
sepOptions.convertSpotColors = false;
sepOptions.overPrintBlack = false;
sepOptions.colorSeparationMode = PrintColorSeparationMode.HOSTBASEDSEPARATION;
docRef.print(options);
CHAPTER 1: JavaScript Object Reference PrintCoordinateOptions 167
PrintCoordinateOptions
Information about the media and associated printing parameters.
PrintCoordinateOptions properties
docRef.print(options);
coordinateOptions.emulsion = false;
coordinateOptions.fitToPage = false;
coordinateOptions.orientation = PrintOrientation.PORTRAIT;
coordinateOptions.horizontalScale = 50;
coordinateOptions.verticalScale = 50;
docRef.print(options);
}
CHAPTER 1: JavaScript Object Reference Printer 169
Printer
Associates an available printer with printer information. To request a list of printers, you must first have a
document open or an error is returned.
Printer properties
PrinterInfo
Configuration information about a printer.
PrinterInfo properties
PrintFlattenerOptions
Contains flattening options for use when Illustrator outputs artwork that contains transparency into a
non-native format.
PrintFlattenerOptions properties
symbolRef = docRef.symbols[i];
symbolItemRef1 = docRef.symbolItems.add(symbolRef);
symbolItemRef1.top = y;
symbolItemRef1.left = 100;
y -= (symbolItemRef1.height + 10);
}
redraw();
// Create PrintFlattenerOptions object and assign to a PrintOptions object
var flatOpts = new PrintFlattenerOptions();
var printOpts = new PrintOptions();
printOpts.flattenerOptions = flatOpts;
// Set other print options
printOpts.ClipComplexRegions = true;
printOpts.GradientResoultion = 360;
printOpts.RasterizatonResotion = 360;
PrintFontOptions
Contains information about font downloading and substitution for the fonts used for printing the
document.
PrintFontOptions properties
// print it
activeDocument.print(printOpts);
CHAPTER 1: JavaScript Object Reference PrintJobOptions 175
PrintJobOptions
Contains information about how the job is to be printed.
PrintJobOptions properties
printJobOptions.designation = PrintArtworkDesignation.ALLLAYERS;
printJobOptions.reverse = true;
docRef.print(options);
printJobOptions.collate = false;
printJobOptions.designation = PrintArtworkDesignation.VISIBLELAYERS;
printJobOptions.reverse = false;
docRef.print(options);
printJobOptions.designation = PrintArtworkDesignation.VISIBLEPRINTABLELAYERS;
var docPath = new File("~/printJobTest1.ps");
printJobOptions.file = docPath;
docRef.print(options);
CHAPTER 1: JavaScript Object Reference PrintOptions 177
PrintOptions
Contains information about all printing options including flattening, color management, coordinates,
fonts, and paper.
PrintOptions properties
PrintPageMarksOptions
The options for printing page marks.
PrintPageMarksOptions properties
pageMarkOptions.colorBars = true;
pageMarkOptions.pageInfoMarks = true;
pageMarkOptions.registrationMarks = true;
pageMarkOptions.trimMarks = true;
docRef.print(options);
CHAPTER 1: JavaScript Object Reference PrintPaperOptions 180
PrintPaperOptions
Information about the paper to be used in the print job.
PrintPaperOptions properties
docRef.print(printOpts);
}
}
CHAPTER 1: JavaScript Object Reference PrintPostScriptOptions 181
PrintPostScriptOptions
Options for printing to a PostScript printer.
PrintPostScriptOptions properties
psOpts.postScriptLevel = PrinterPostScriptLevelEnum.PSLEVEL3;
activeDocument.print(printOpts);
CHAPTER 1: JavaScript Object Reference RasterEffectOptions 182
RasterEffectOptions
Specifies raster effects settings for the document. All properties are optional.
RasterEffectOptions properties
RasterItem
A bitmap art item in a document. A script can create a raster item from an external file, or by copying an
existing raster item with the duplicate method.
RasterItem properties
position array of The position (in points) of the top left corner of the
2 numbers rasterItem object in the format [x, y]. Does not include
stroke weight.
selected boolean If true, this item is selected.
sliced boolean If true, the item sliced. Default: false
status RasterLinkState Status of the linked image.
tags Tags Read-only. The tags contained in this item.
top number (double) The position of the top of the item (in points, measured
from the bottom of the page).
transparent boolean Read-only. If true, the raster art is transparent.
typename string Read-only. The class name of the referenced object.
uRL string The value of the Adobe URL tag assigned to this item.
visibilityVariable Variable The visibility variable bound to the item.
visibleBounds array of Read-only. The visible bounds of the item including stroke
4 numbers width.
width number (double) The width of the item.
wrapInside boolean If true, the text frame object should be wrapped inside
this object.
wrapOffset number (double) The offset to use when wrapping text around this object.
wrapped boolean If true, wrap text frame objects around this object (text
frame must be above the object).
zOrderPosition number Read-only. The position of this item within the stacking
order of the group or layer (parent) that contains the
item.
CHAPTER 1: JavaScript Object Reference RasterItem 185
RasterItem methods
RasterItems
A collection of RasterItem objects.
RasterItems properties
RasterItems methods
function createRasterItem(jpgFilePath) {
var rasterFile = File(jpgFilePath);
var myDoc = app.documents.add();
var myPlacedItem = myDoc.placedItems.add();
myPlacedItem.file = rasterFile;
myPlacedItem.position = Array( 0, myDoc.height );
myPlacedItem.embed();
}
CHAPTER 1: JavaScript Object Reference RasterItems 188
switch ( rasterArt.imageColorSpace ) {
case ImageColorSpace.CMYK:
$.writeln("The color space of the first raster item is CMYK");
break;
case ImageColorSpace.RGB:
$.writeln("The color space of the first raster item is RGB");
break;
case ImageColorSpace.GRAYSCALE:
$.writeln("The color space of the first raster item is GRAYSCALE");
break;
}
}
CHAPTER 1: JavaScript Object Reference RasterizeOptions 189
RasterizeOptions
Specifies options that may be supplied when rasterizing artwork. All properties are optional.
RasterizeOptions properties
RGBColor
An RGB color specification, used to apply an RGB color to a layer or art item.
If the color space of a document is RGB and you specify the color value for a page item in that document
using CMYK, Illustrator will translate the CMYK color specification into an RGB color specification. The same
thing happens if the documents color space is CMYK and you specify colors using RGB. Since this
translation can lose information, you should specify colors using the class that matches the documents
actual color space.
RGBColor properties
if ( app.documents.length > 0 ) {
// Define the new color
var newRGBColor = new RGBColor();
newRGBColor.red = 255;
newRGBColor.green = 255;
newRGBColor.blue = 0;
app.activeDocument.defaultFillColor = newRGBColor;
}
CHAPTER 1: JavaScript Object Reference Screen 191
Screen
Associates a color separation screen with information to be used for printing.
Screen properties
ScreenInfo
Contains information about the angle and frequency of the color separation screen to be used for printing.
ScreenInfo properties
ScreenSpotFunction
Contains information about a color separation screen spot function, including its definition in PostScript
language code.
ScreenSpotFunction properties
Spot
A custom color definition contained in a SpotColor object.
If no properties are specified when creating a spot, default values are provided. However, if specifying the
color, you must use the same color space as the document, either CMYK or RGB. Otherwise, an error
results. The new spot is added to the end of the swatches list in the Swatches palette.
Spot properties
Spot methods
if ( app.documents.length > 0 ){
var doc = app.activeDocument;
// Create the new spot
var newSpot = doc.spots.add();
// Define the new color value
var newColor = new CMYKColor();
newColor.cyan = 35;
newColor.magenta = 0;
newColor.yellow = 50;
newColor.black = 0;
// Define a new SpotColor with an 80% tint
// of the new Spot's color. The spot color can then
// be applied to an art item like any other color.
newSpot.name = "Pea-Green";
newSpot.colorType = ColorModel.SPOT;
newSpot.color = newColor;
var newSpotColor = new SpotColor();
newSpotColor.spot = newSpot;
newSpotColor.tint = 80;
}
CHAPTER 1: JavaScript Object Reference SpotColor 196
SpotColor
Color class used to apply the color value of a spot at a specified tint value. Can be used in any property that
takes a color object.
SpotColor properties
Spots
A collection of SpotColor objects in a document.
Spots properties
Spots methods
getByName Spot Gets the first element in the collection with the specified
(name) string name.
index Spot Gets an element from the collection.
(itemKey) string, number
if ( app.documents.length > 0 ) {
var spotCount = app.activeDocument.spots.length;
if (spotCount > 0) {
app.activeDocument.spots.removeAll();
}
}
CHAPTER 1: JavaScript Object Reference Spots 198
// Apply a 50% tint of the new spot color to the frontmost path item.
Story
A contiguous block of text as specified by a text range. A story can contain one or more text frames; if there
is more than one, the multiple text frames are linked together to form a single story.
Story properties
Stories
A collection of Story objects in a document.
Stories properties
Stories methods
Swatch
A color swatch definition contained in a document. The swatches correspond to the swatch palette in the
Illustrator user interface. A script can create a new swatch. The swatch can hold all types of color data, such
as pattern, gradient, CMYK, RGB, gray, and spot.
Swatch properties
Swatch methods
Modifying a swatch
// Changes the name of the last swatch
Swatches
A collection of Swatch objects in a document.
Swatches properties
Swatches methods
getByName Swatch Gets the first element in the collection with the specified
(name) string name.
getSelected List of Gets selected swatches in the document.
() Swatch
if ( app.documents.length > 0 ) {
if (app.activeDocument.swatches.length > 4)
{
swatchToDelete = app.activeDocument.swatches[3];
swatchToDelete.remove();
}
}
CHAPTER 1: JavaScript Object Reference SwatchGroup 204
SwatchGroup
A group of Swatch objects.
SwatchGroup properties
SwatchGroup methods
SwatchGroups
A collection of SwatchGroup objects.
SwatchGroups properties
SwatchGroups methods
Symbol
An art item that is stored in the Symbols palette, and can be reused one or more times in the document
without duplicating the art data. Symbols are contained in documents. Instances of Symbol in a document
are associated with SymbolItem objects, which store the art object properties.
Symbol properties
Symbol methods
SymbolItem
An art item made reusable by adding it to the Symbols palette. A SymbolItem is linked to the Symbol from
which it was created and changes if you modify the associated Symbol object.
SymbolItem properties
position array of 2 numbers The position (in points) of the top left corner of the
symbolItem object in the format [x, y]. Does not
include stroke weight.
selected boolean If true, this item is selected.
sliced boolean If true, the item sliced. Default: false
symbol Symbol The symbol that was used to create this symbolItem.
tags Tags Read-only. The tags contained in this item.
top number (double) The position of the top of the item (in points,
measured from the bottom of the page).
CHAPTER 1: JavaScript Object Reference SymbolItem 208
SymbolItem methods
SymbolItems
A collection of SymbolItem objects in the document.
SymbolItems properties
SymbolItems methods
getByName SymbolItem Gets the first element in the collection with the
(name) string specified name.
index SymbolItem Gets an element from the collection.
(itemKey) string, number
Symbols
The collection of Symbol objects in the document.
Symbols properties
Symbols methods
Creating a symbol
// Creates a path item from each graphic style
// then adds each item as a new symbol
TabStopInfo
Information about the alignment, position, and other details for a tab stop in a ParagraphAttributes
object.
TabStopInfo properties
docRef = app.activeDocument;
var tabRef;
var sData = "Tab Stops Found \rTabStop Leader\t\tTabStop Position\r";
var textRef = docRef.textFrames;
Tag
A label associated with a specific piece of artwork. Tags allows you to assign an unlimited number of
key-value pairs to any page item in a document.
Tag properties
Tag methods
Using tags
// Finds the tags associated with the selected art item,
// show names and values in a separate document
if ( app.documents.length > 0 ) {
doc = app.activeDocument;
if ( doc.selection.length > 0 ) {
for ( i = 0; i < selection.length; i++ ) {
selectedArt = selection[0];
tagList = selectedArt.tags;
if (tagList.length == 0) {
var tempTag = tagList.add();
tempTag.name = "OneWord";
tempTag.value = "anything you want";
}
// Create a document and add a line of text per tag
reportDocument = app.documents.add();
top_offset = 400;
for ( i = 0; i < tagList.length; i++ ) {
tagText = tagList[i].value;
newItem = reportDocument.textFrames.add();
newItem.contents = "Tag: (" + tagList[i].name +
" , " + tagText + ")";
newItem.position = Array(100, top_offset);
newItem.textRange.size = 24;
top_offset = top_offset - 20;
}
}
CHAPTER 1: JavaScript Object Reference Tag 215
}
}
CHAPTER 1: JavaScript Object Reference Tags 216
Tags
A collection of Tag objects.
Tags properties
Tags methods
getByName Tag Gets the first element in the collection with the specified
(name) string name.
index Tag Gets an element from the collection.
(itemKey) string, number
if ( app.documents.length > 0 ) {
doc = app.activeDocument;
if ( doc.placedItems.length + doc.rasterItems.length > 0 ) {
for ( i = 0; i < doc.pageItems.length; i++ ) {
imageArt = doc.pageItems[i];
if ( imageArt.typename == "PlacedItem"
|| imageArt.typename == "RasterItem") {
// Create a new Tag with the name AdobeURL and the
// value of the www link
urlTAG = imageArt.tags.add();
urlTAG.name = "AdobeWebSite";
urlTAG.value = "http://www.adobe.com/";
}
}
}
else {
alert( "No placed or raster items in the document" );
}
}
CHAPTER 1: JavaScript Object Reference TextFont 217
TextFont
Information about a font in the document, found in a CharacterAttributes object.
TextFont properties
if ( app.documents.length > 0 ) {
// Iterate through all text art and apply font 0
for ( i = 0; i< app.activeDocument.textFrames.length; i++) {
textArtRange = app.activeDocument.textFrames[i].textRange;
textArtRange.characterAttributes.textFont = app.textFonts[0];
}
}
CHAPTER 1: JavaScript Object Reference TextFonts 218
TextFonts
A collection of TextFont objects.
TextFonts properties
TextFonts methods
getByName TextFont Get the first element in the collection with the
(name) string provided name.
Finding fonts
// Creates a new A3 sized document and display a list of available fonts until the
document is full.
// check wether the text frame will go off the edge of the document
CHAPTER 1: JavaScript Object Reference TextFonts 219
TextFrameItem
The basic art item for displaying text. From the user interface, this is text created with the Text tool. There
are three types of text art in Illustrator: point text, path text, and area text. The type is indicated by the text
frames kind property.
When you create a text frame, you also create a Story object. However, threading text frames combines the
frames into a single story object. To thread frames, use the nextFrame or previousFrame property.
TextFrameItem properties
TextFrameItem methods
if ( app.documents.length > 0 ) {
selectedItems = app.activeDocument.selection;
// make sure something is selected.
if ( selectedItems.length > 0 ) {
// The selection must be a text art item
if ( selectedItems[0].typename == "TextFrame" ) {
// Get the parent of the text art so new text art items
// can be inserted in the same group or layer
dupSrc = selectedItems[0];
textContainer = dupSrc.parent;
// Create 5 new versions of the text art each rotated a bit
for ( i = 1; i <= 5; i++ ) {
dupText = dupSrc.duplicate( textContainer,
ElementPlacement.PLACEATEND );
dupText.rotate(180 * i/6);
}
}
}
}
CHAPTER 1: JavaScript Object Reference TextFrameItems 224
TextFrameItems
A collection of TextFrameItem objects.
TextFrameItems properties
TextFrameItems methods
// Line Text
var lineRef = docRef.pathItems.add();
lineRef.setEntirePath( Array(Array(200, 700), Array(300, 550) ) );
var pathTextRef = docRef.textFrames.pathText(lineRef);
pathTextRef.contents = "TextFrame #2";
pathTextRef.selected = true;
// Point Text
var pointTextRef = docRef.textFrames.add();
pointTextRef.contents = "TextFrame #3";
pointTextRef.top = 700;
pointTextRef.left = 400;
pointTextRef.selected = true;
redraw();
docRef.textFrames[1].remove();
redraw();
// count again
var iCount = docRef.textFrames.length;
CHAPTER 1: JavaScript Object Reference TextPath 226
TextPath
A path or list of paths for area or path text. A path consists of path points that define its geometry.
TextPath properties
TextPath methods
TextRange
A range of text in a specific text art item. TextRange gives you access to the text contained in text art
items.
TextRange properties
TextRange methods
Manipulating text
// Changes size of the first character of each word in the
// current document by changing the size attribute of each character
if ( app.documents.length > 0 ) {
for ( i = 0; i < app.activeDocument.textFrames.length; i++ ) {
text = app.activeDocument.textFrames[i].textRange;
for ( j = 0 ; j < text.words.length; j++ ) {
//each word is a textRange object
textWord = text.words[j];
// Characters are textRanges too.
// Get the first character of each word and increase it's size.
firstChars = textWord.characters[0];
firstChars.size = firstChars.size * 1.5;
}
}
}
CHAPTER 1: JavaScript Object Reference TextRanges 230
TextRanges
A collection of TextRange objects.
TextRanges properties
TextRanges methods
TracingObject
A tracing object, which associates source raster art item with a vector-art plug-in group created by tracing.
Scripts can initiate tracing using PlacedItem.trace or RasterItem.trace. The resulting PluginItem
object represents the vector art group, and has this object in its tracing property.
A script can force the tracing operation by calling the applications redraw method. The operation is
asynchronous, so a script should call redraw after creating the tracing object, but before accessing its
properties or expanding the tracing to convert it to an art item group.
The read-only properties that describe the tracing result have valid values only after the first tracing
operation completes. A value of 0 indicates that the operation has not yet been completed.
TracingObject properties
TracingObject methods
TracingOptions
A set of options used in converting raster art to vector art by tracing.
TracingOptions properties
palette string The name of a color palette to use for tracing. If the
empty string, use the automatic palette. Used only if
tracingMode is color or grayscale.
TracingOptions methods
Variable
A document-level variable that can be imported or exported.
A variable is a dynamic object used to create data-driven graphics. For an example, see Dataset. Variables
are accessed in Illustrator through the Variables palette.
Variable properties
Variable methods
Variables
The collection of Variable objects in the document. For an example of how to create variables, see Using
variables and datasets.
Variables properties
Variables methods
getByName Variable Get the first element in the collection with the provided
(name) string name.
index Variable Get an element from the collection.
(itemKey) string, number
View
A document view in an Illustrator document, which represents a window view onto a document. Scripts
cannot create new views, but can modify some properties of existing views, including the center point,
screen mode, and zoom.
View properties
if ( app.documents.length > 0 ) {
app.documents[0].views[0].screenMode = ScreenMode.FULLSCREEN;
}
CHAPTER 1: JavaScript Object Reference Views 238
Views
A collection of View objects in a document.
Views properties
Views methods
Words
A collection of words in a text item, where each word is a TextRange object. The elements are not named;
you must access them by index.
Words properties
Words methods
Counting words
// Counts all words in current document and stores total in numWords
if ( app.documents.length > 0 ) {
numWords = 0;
for ( i = 0; i < app.activeDocument.textFrames.length; i++) {
numWords += app.activeDocument.textFrames[i].words.length;
}
}
CHAPTER 1: JavaScript Object Reference Words 240
Scripting Constants
This chapter lists and describes the enumerations defined for use with Illustrator JavaScript properties and
methods.
Constant
Type Values What it means
AlternateGlyphsForm
DEFAULTFORM THIRDWIDTH
TRADITIONAL QUARTERWIDTH
EXPERT FULLWIDTH
JIS78FORM PROPORTIONALWIDTH
JIS83FORM JIS90FORM
HALFWIDTH JIS04FORM
AntiAliasingMethod
OUTPUTARTBOARDBOUNDS
Output size is the size of the
artboard.
OUTPUTCROPRECTBOUNDS
Output size is the size of the crop
area.
AutoCADColors
Max8Colors Max256Colors
Max16Colors TrueColors
241
CHAPTER 2: Scripting Constants 242
Constant
Type Values What it means
AutoCADCompatibility
AutoCADRelease13 AutoCADRelease18
AutoCADRelease14 AutoCADRelease21
AutoCADRelease15 AutoCADRelease24
AutoCADExportFileFormat
DXF DWG
AutoCADExportOption
PreserveAppearance
MaximizeEditability
AutoCADGlobalScaleOption
OriginalSize ScaleByValue
FitArtboard
AutoCADRasterFormat
PNG JPEG
AutoCADUnit
Points Millimeters
Picas Centimeters
Inches Pixels
AutoKernType
NOAUTOKERN OPTICAL
AUTO METRICSROMANONLY
AutoLeadingType
BOTTOMTOBOTTOM TOPTOTOP
BaselineDirectionType
Standard VerticalRotated
TateChuYoko
BlendAnimationType
INBUILD NOBLENDANIMATION
INSEQUENCE
BlendModes
Constant
Type Values What it means
BlendsExpandPolicy Policy used by FXG file format to
expand blends.
AUTOMATICALLYCONVERTBLENDS
RASTERIZEBLENDS
BurasagariTypeEnum
Forced Standard
None
CaseChangeType
LOWERCASE TITLECASE
SENTENCECASE UPPERCASE
ColorConversion
COLORCONVERSIONREPURPOSE
COLORCONVERSIONTODEST
None
ColorConvertPurpose
COLORDESTINATIONDOCCMYK
COLORDESTINATIONDOCRGB
COLORDESTINATIONPROFILE
COLORDESTINATIONWORKINGCMYK
COLORDESTINATIONWORKINGRGB
None
ColorDitherMethod
PROCESS SPOT
REGISTRATION
ColorProfile
INCLUDEALLPROFILE LEAVEPROFILEUNCHANGED
INCLUDEDESTPROFILE None
INCLUDERGBPROFILE
ColorReductionMethod
Constant
Type Values What it means
ColorType
Compatibility
CompressionQuality
CoordinateSystem
DocumentColorSpace
Constant
Type Values What it means
DocumentPresetType
DocumentPreviewMode
DocumentRasterResolution
DocumentTransparencyGrid
DocumentType
DownsampleMethod
AVERAGEDOWNSAMPLE NODOWNSAMPLE
BICUBICDOWNSAMPLE SUBSAMPLE
ElementPlacement
INSIDE PLACEBEFORE
PLACEATBEGINNING PLACEAFTER
PLACEATEND
EPSPostScriptLevelEnum
LEVEL2
LEVEL3
EPSPreview
Constant
Type Values What it means
ExportType
FigureStyleType
DEFAULTFIGURESTYLE TABULAR
PROPORTIONAL TABULAROLDSTYLE
PROPORTIONALOLDSTYLE
FiltersPreservePolicy
FlashExportStyle
FlashExportVersion
FlashImageFormat
FlashJPEGMethod
PlaybackLocal
PlaybackNetwork
FontBaselineOption
NORMALBASELINE
SUPERSCRIPT
SUBSCRIPT
FontCapsOption
ALLCAPS NORMALCAPS
ALLSMALLCAPS SMALLCAPS
CHAPTER 2: Scripting Constants 247
Constant
Type Values What it means
FontOpenTypePositionOption
DENOMINATOR OPENTYPESUBSCRIPT
NUMERATOR OPENTYPESUPERSCRIPT
OPENTYPEDEFAULT
FontSubstitutionPolicy
SUBSTITUTEDEVICE
SUBSTITUTEOBLIQUE
SUBSTITUTETINT
FXGVersion
GradientsPreservePolicy
ImageColorSpace
InkPrintStatus
CONVERTINK
ENABLEINK
DISABLEINK
InkType
BLACKINK MAGENTAINK
CUSTOMINK YELLOWINK
CYANINK
JavaScriptExecutionMode
BeforeRunning
OnRuntimeError
never
Justification
Constant
Type Values What it means
KinsokuOrderEnum
PUSHIN
PUSHOUTONLY
PUSHOUTFIRST
KnockoutState
BOKMALNORWEGIAN JAPANESE
BRAZILLIANPORTUGUESE NYNORSKNORWEGIAN
BULGARIAN OLDGERMAN
CANADIANFRENCH POLISH
CATALAN RUMANIAN
CHINESE RUSSIAN
CZECH SERBIAN
DANISH SPANISH
DUTCH STANDARDFRENCH
DUTCH2005REFORM STANDARDGERMAN
ENGLISH STANDARDPORTUGUESE
FINNISH SWEDISH
GERMAN2006REFORM SWISSGERMAN
GREEK SWISSGERMAN2006REFORM
HUNGARIAN TURKISH
ICELANDIC UKENGLISH
ITALIAN UKRANIAN
LayerOrderType
TOPDOWN
BOTTOMUP
LibraryType
MonochromeCompression
Constant
Type Values What it means
PageMarksTypes
Japanese
Roman
PathPointSelection
PDFBoxType
PDFARTBOX PDFCROPBOX
PDFBLEEDBOX PDFMEDIABOX
PDFBOUNDINGBOX PDFTRIMBOX
PDFChangesAllowedEnum
CHANGE128ANYCHANGES CHANGE40ANYCHANGES
CHANGE128COMMENTING CHANGE40COMMENTING
CHANGE128EDITPAGE CHANGE40PAGELAYOUT
CHANGE128FILLFORM CHANGE40NONE
CHANGE128NONE
PDFCompatibility
PDFOverprint
DISCARDPDFOVERPRINT
PRESERVEPDFOVERPRINT
PDFPrintAllowedEnum
PRINT128HIGHRESOLUTION
PRINT128LOWRESOLUTION
PRINT128NONE
PRINT40HIGHRESOLUTION
PRINT40NONE
PDFTrimMarkWeight
TRIMMARKWEIGHT0125
TRIMMARKWEIGHT05
TRIMMARKWEIGHT025
PDFXStandard
PDFXNONE PDFX32002
PDFX1A2001 PDFX32003
PDFX1A2003 PDFX42007
CHAPTER 2: Scripting Constants 250
Constant
Type Values What it means
PerspectiveGridType
OnePointPerspectiveGridType
TwoPointPerspectiveGridType
ThreePointPerspectiveGridType
InvalidPerspectiveGridType
PerspectiveGridPlaneType
GRIDLEFTPLANETYPE
GRIDRIGHTPLANETYPE
GRIDFLOORPLANETYPE
INVALIDGRIDPLANETYPE
PhotoshopCompatibility
Photoshop6
Photoshop8
PointType
PolarityValues
NEGATIVE
POSITIVE
PostScriptImageCompressionType
IMAGECOMPRESSIONNONE
RLE
JPEG
PrintArtworkDesignation
ALLLAYERS
VISIBLELAYERS
VISIBLEPRINTABLELAYERS
PrintColorIntent
ABSOLUTECOLORIMETRIC
PERCEPTUALINTENT
RELATIVECOLORIMETRIC
SATURATIONINTENT
PrintColorProfile
CUSTOMPROFILE PRINTERPROFILE
OLDSTYLEPROFILE SOURCEPROFILE
PrintColorSeparationMode
COMPOSITE
HOSTBASEDSEPARATION
INRIPSEPARATION
CHAPTER 2: Scripting Constants 251
Constant
Type Values What it means
PrinterColorMode
BLACKANDWHITEPRINTER
GRAYSCALEPRINTER
COLORPRINTER
PrinterPostScriptLevelEnum
PSLEVEL1
PSLEVEL2
PSLEVEL3
PrinterTypeEnum
NONPOSTSCRIPTPRINTER
POSTSCRIPTPRINTER
Unknown
PrintFontDownloadMode
DOWNLOADNONE
DOWNLOADCOMPLETE
DOWNLOADSUBSET
PrintingBounds
ARTBOARDBOUNDS
ARTWORKBOUNDS
PrintOrientation
PrintPosition
TRANSLATEBOTTOM TRANSLATERIGHT
TRANSLATEBOTTOMLEFT TRANSLATETOP
TRANSLATEBOTTOMRIGHT TRANSLATETOPLEFT
TRANSLATECENTER TRANSLATETOPRIGHT
TRANSLATELEFT
PrintTiling
TILEFULLPAGES
TILESINGLEFULLPAGE
TILEIMAGEABLEAREAS
RasterizationColorModel
RasterLinkState
Constant
Type Values What it means
RulerUnits
SaveOptions
ScreenMode
SpotColorKind
StrokeCap
StrokeJoin
StyleRunAlignmentType
bottom icfTop
center ROMANBASELINE
icfBottom top
SVGCSSPropertyLocation
Constant
Type Values What it means
SVGDTDVersion
SVGFontSubsetting
SVGFontType
SymbolRegistrationPoint
TabStopAlignment
TextAntialias
TextOrientation
TextType
Constant
Type Values What it means
TIFFByteOrder
TRACINGMODEBLACKANDWHITE
TRACINGMODECOLOR
TRACINGMODEGRAY
Transformation
TrappingType
IGNOREOPAQUE OPAQUE
NORMALTRAPPING TRANSPARENT
UserInteractionLevel
VariableKind
ViewRasterType
ViewVectorType
WariChuJustificationType
Center
Left
Right
WARICHUAUTOJUSTIFY
WARICHUFULLJUSTIFY
WARICHUFULLJUSTIFYLASTLINECENTER
WARICHUFULLJUSTIFYLASTLINELEFT
WARICHUFULLJUSTIFYLASTLINERIGHT
CHAPTER 2: Scripting Constants 255
Constant
Type Values What it means
ZOrderMethod