Illustrator Scripting Reference — JavaScript


Чтобы посмотреть этот PDF файл с форматированием и разметкой, скачайте его и откройте на своем компьютере.
ADOBE® ILLUSTRATOR® CC 2014
ADOBE ILLUSTRATOR CC 2014
SCRIPTING REFERENCE:
JAVASCRIPT
2014 Adobe Systems Incorporated. All rights reserved.
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, mech
anical, 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 on
ly, is subject to change without notice, and should not be
construed as a commitment by Adobe Systems Incorporated. Ad
obe 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 ma
y 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 on
ly and are not intended to
refer to any actual organization.
Adobe, the Adobe logo, Acrobat, Flash, Illustrator, Macrom
edia, 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 regi
stered trademarks of Sun Microsystems, Incorporated in the
United States and other countries.
All other trademarks are the property of their respective owners.
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 th
at term is defined at 48 C.F.R. §2.101, consisting of
Commercial Computer SoftwareŽ and Commercial Computer So
ftware 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 Co
mmercial 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 applic
able equal opportunity laws including, if appropriate, the
provisions of Executive Order 11246, as amended, Section 402
3
Contents
1JavaScript Object Reference .
. . . . . . . . . . . . . . 7
Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Artboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . 13
Artboards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . 14
Brush . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Brushes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . 16
CharacterAttributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . 17
Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . 21
CharacterStyle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . 22
CharacterStyles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . 23
CMYKColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . 25
Color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . 26
CompoundPathItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . 27
CompoundPathItems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . 31
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
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
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
2Scripting Constants . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7
JavaScript Object Reference
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
HAPTER
1: JavaScript Object Reference
Application
8
Application
The Adobe® Illustrator® application object
, referenced using the pre-defined global
object, which
contains all other Illustrator objects.
Application properties
Property
Value type
What it is
activeDocument
Document
The active (frontmost) document in Illustrator.
browserAvailable
boolean
Read-only. If
, a web browser is available.
buildNumber
string
Read-only. The applications build number.
The coordinate system currently in use,
document or artboard.
Read-only. The documents in the application.
Read-only. The list of installed printers.
HAPTER
1: JavaScript Object Reference
Application
9
Read-only. The installed fonts.
What level of interaction with the user should be
allowed when handling script commands.
version
string
Read-only. The applications version.
visible
boolean
Read-only. If
, the application is visible.
Property
Value type
What it is
Method
ColorComponents
ImageColorSpace
ColorConvertPurpose
boolean
boolean
array
ColorComponents
Converts a sample-component
color from one color space to
another.
Copies current selection to the
clipboard.
HAPTER
1: JavaScript Object Reference
Application
10
Cuts current selection to the
clipboard.
deleteWorkspace()
(workspaceName)
string
Boolean
Deletes an existing workspace.
File
HAPTER
1: JavaScript Object Reference
Application
11
isEqualMatrix
(matrix,
secondMatrix)
Matrix
Matrix
boolean
Document
Opens the specified document file.
If you open a pre-Illustrator 9
document that contains both
RGB and CMYK colors and
documentColorSpace
is supplied,
all colors are converted to the
specified color space. If
parameter
is not supplied,
Illustrator opens a dialog so the
user can choose the color space.
paste()
Pastes current clipboard content
into the current document.
Quits Illustrator. Note that if the
clipboard contains data, Illustrator
may show a dialog prompting the
user to save the data for other
applications.
redo()
Redoes the most recently undone
transaction.
redraw
Forces Illustrator to redraw all its
windows.
resetWorkspace()
Boolean
HAPTER
1: JavaScript Object Reference
Application
12
Duplicating the active document
// Duplicates any selected items from
// the active document into a new document.
var newItem;
var docSelected = app.activeDocument.selection;
if ( docSelected.len�gth 0 ) {
// Create a new document and move the selected items to it.
var newDoc = app.documents.add();
if ( docSelected.len�gth 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" );
translatePlaceholderText
(text)
string
string
Translates the placeholder text to
regular text (a way to enter
Unicode points in hex values).
undo()
Undoes the most recent
transaction.
Method
HAPTER
1: JavaScript Object Reference
Artboard
13
Artboard
An
object represents a single artboard in a document. There can be between 1 to 100 artboards
in one document.
Artboard properties
Read-only. The parent of this object.
rulerOrigin
Point
Ruler origin of the artboard, relative to the top left corner of the
artboard.
rulerPAR
number (double)
Pixel aspect ratio, used in rule
r visualization if the units are
pixels. Range: 0.1 to 10.0
showCenter
boolean
Show center mark.
showCrossHairs
boolean
Show cross hairs.
showSafeAreas
boolean
Show title and action safe areas (for video).
typename
string
Read-only. The class name of this object.
HAPTER
1: JavaScript Object Reference
Artboards
14
Artboards
A collection of
Artboard
objects.
Artboards properties
Read-only. The name of the obje
Creates a new
Artboard
object.
object and
inserts it at the given index in the list.
remove
(index)
number (long)
HAPTER
1: JavaScript Object Reference
Brush
15
A brush in an Illustrator document. Brushes are co
ntained 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
Read-only. The document that contains this
brush
typename
string
Read-only. The class name of the referenced object.
NothingApplies the
to a specific art item.
HAPTER
1: JavaScript Object Reference
16
A collection of
brush
objects in a document.
Brushes properties
HAPTER
1: JavaScript Object Reference
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.
The character alignment type.
alternateGlyphs
AlternateGlyphsForm
The alternate glyphs form.
autoLeading
true
, the automatic leading
should be used.
baselineDirection
BaselineDirectionType
The Japanese text baseline
direction.
baselinePosition
FontBaselineOption
The baseline position of text.
baselineShift
number (double)
The amount of shift in points of
the text baseline.
capitalization
FontCapsOption
The case of text.
connectionForms
true
, the OpenType
connection forms should be
used.
contextualLigature
true
, the contextual ligature
should be used.
The number style in an
OpenType font.
fillColor
The color of the text fill.
HAPTER
1: JavaScript Object Reference
18
fractions
true
, the OpenType fractions
should be used.
horizontalScale
number (double)
The character horizontal scaling
factor expressed as a
percentage (100 = 100%).
italics
true
, the Japanese OpenType
font supports italics.
The language of text.
leading
number (double)
The OpenType baseline
position.
ordinals
true
, the OpenType ordinals
should be used.
ornaments
true
, the OpenType
ornaments should be used.
overprintFill
true
the fill of the text should
be overprinted.
overprintStroke
true
, the stroke of the text
should be overprinted.
parent
object
Read-only. The objects
container.
The color of the text stroke.
strokeWeight
number (double)
Line width of stroke.
PropertyValue typeWhat it is
HAPTER
1: JavaScript Object Reference
19
stylisticAlternates
true
, the OpenType stylistic
alternates should be used.
swash
true
, the OpenType swash
should be used.
tateChuYokoHorizontal
number (long)
The Tate-Chu-Yoko horizontal
adjustment in points.
tateChuYokoVertical
number (long)
The Tate-Chu-Yoko vertical
adjustment in points.
textFont
TextFont
The text font.
titling
true
, the OpenType titling
alternates should be used.
tracking
number (long)
The tracking or range kerning
amount, in thousandths of an
em.
Tsume
number (double)
The percentage of space
reduction around a Japanese
character.
typename
Read-only. The class name of
the object.
underline
true
, characters are
underlined.
verticalScale
number (double)
Character vertical scaling factor
expressed as a percentage (100
wariChuCharactersAfterBreak
number (long)
Specifies how the characters in
The Wari-Chu justification.
wariChuLineGap
number (long)
The Wari-Chu line gap.
wariChuLines
number (long)
The number of Wari-Chu
(multiple text lines fit into a
space meant for one) lines.
wariChuScale
number (double)
The Wari-Chu scale.
PropertyValue typeWhat it is
HAPTER
1: JavaScript Object Reference
20
Setting character attributes
// Creates a new document, adds a simple text item
// then incrementally increases the horizontal and
// vertical scale attributes of each character
var docRef = documents.add();
var textRef = docRef.textFrames.add();
textRef.contents = "I Love Scripting!";
textRef.top = 400;
textRef.left = 100;
// incrementally increase the scale of each character
var charCount = textRef.textRange.characters.length;
var size = 100;
for(i=0; icharCount; i++, size *= 1.2) {
textRef.textRange.characters[i].characterAttributes.horizontalScale
textRef.textRange.characters[i].characterAttributes.verticalScale
HAPTER
1: JavaScript Object Reference
21
Characters
A collection of characters (
TextRange
objects of length 1). The elements are not named; you must access
them by index.
Characters properties
ElementPlacement
TextRange
Adds a new character with
specified text contents at the
specified location in the current
document. If a location is not
specified, adds the new character
to the containing text frame after
the current text selection or
insertion point.
addBefore
(contents)string
TextRange
Adds a character before the
specified text selection.
index
(itemKey)number
TextRange
HAPTER
1: JavaScript Object Reference
CharacterStyle
22
CharacterStyle
Associates character attributes with characters. For an example, see
CharacterStyles
CharacterStyle properties
Read-only. The character properties for the style.
name
The character styles name.
parent
object
Read-only. The objects container.
typename
Read-only. The class name of the object.
HAPTER
1: JavaScript Object Reference
23
CharacterStyles
A collection of
CharacterStyle
objects.
CharacterStyles properties
Creates a named character style.
Gets an element from the collection.
removeAll
HAPTER
1: JavaScript Object Reference
24
HAPTER
1: JavaScript Object Reference
25
CMYKColor
A CMYK color specification, used where a
object is required.
If the color space of a document is
and you specify the color value for a page item in that document
using CMYK, Illustrator will translate the CMYK color spec
ification into an RGB color specification. The same
thing happens if the documents 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 documents
actual color space.
CMYKColor properties
Setting a CMYK color
HAPTER
1: JavaScript Object Reference
26
Color
An abstract parent class for all color classes used in Illustrator. Subclasses are:
CMYKColor
GradientColor
GrayColor
LabColor
NoColor
PatternColor
RGBColor
SpotColor
HAPTER
1: JavaScript Object Reference
27
CompoundPathItem
A compound path. These objects are composed of mult
iple 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.
Is this object used to create a knockout, and if so, what
kind of knockout.
blendingMode
BlendModes
The mode used when compositing an object.
controlBounds
array
4numbers
Read-only. The bounds of the object including stroke
width and controls.
editable
boolean
Read-only. If
true
, this item is editable.
Read-only. The layer to which this compound path item
belongs.
left
number(double)
The position of the left side of the item (in points,
measured from the left side of the page).
locked
boolean
If
true
, this compound path item is locked.
name
string
The name of this compound path item.
note
string
The note assigned to this item.
opacity
number (double)
The opacity of the object. Range: 0.0 to 100.0
parent
Layer
or
GroupItem
Read-only. The parent of this object.
pathItems
PathItems
Read-only. The path art items in this compound path.
HAPTER
1: JavaScript Object Reference
28
position
array
2numbers
The position (in points) of the top left corner of the
compoundPathItem
object in the format [x, y]. Does not
include stroke weight.
selected
boolean
If
true
, this compound path item is selected.
sliced
boolean
If
true
, the item is sliced. Default:
tags
Tags
Read-only. The tags contained in this object.
number (double)
The position of the top of the item (in points, measured
from the bottom of the page).
typename
string
Read-only. Read-only. The class name of the referenced
object.
string
The value of the Adobe URL tag assigned to this
compound path item.
visibilityVariable
Variant
The visibility variable bound to the item.
visibleBounds
array
4numbers
Read-only. The visible bounds of the compound path item
including stroke width.
width
number (double)
The width of the compound path item excluding stroke
width.
wrapInside
boolean
If
true
, the text frame object should be wrapped inside
this object.
HAPTER
1: JavaScript Object Reference
29
CompoundPath
Creates a duplicate of the
selected object.
move
(relativeObject,
insertionLocation)
object
ElementPlacement
NothingMoves the object.
remove
NothingScales the art item where
is the horizontal
scaling factor and
is the vertical scaling
factor. 100.0 = 100%.
rotate
(angle
[,changePositions]
[,changeFillPatterns]
[,changeFillGradients]
[,changeStrokePattern]
[,rotateAbout])
number (double)
boolean
boolean
boolean
boolean
Transformation
NothingRotates the art item
relative to the current
rotation. The object is
rotated
counter-clockwise if the
value is positive,
clockwise if the value is
negative.
transform
(transformationMatrix
[,changePositions]
[,changeFillPatterns]
[,changeFillGradients]
[,changeStrokePattern]
[,changeLineWidths]
[,transformAbout])
Matrix
boolean
boolean
boolean
boolean
number (double)
Transformation
NothingTransforms the art item
by applying a
transformation matrix.
translate
([deltaX]
[,deltaY]
[,transformObjects]
[,transformFillPatterns]
[,transformFillGradients]
[,transformStrokePatterns])
number (double)
number (double)
boolean
boolean
boolean
boolean
NothingRepositions the art item
relative to the current
position, where
deltaX
NothingArranges the art items
position in the stacking
order of the group or
layer (parent) of this
object.
HAPTER
1: JavaScript Object Reference
30
Selecting paths in a document
// Selects all paths not part of a compound path
if ( app.documents.l�ength 0 ) {
doc = app.activeDocument;
count = 0;
if ( doc.pathItems.l�ength 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++;
Creating and modifying a compound path item
// Creates a new compound path item containing 3 path
HAPTER
1: JavaScript Object Reference
CompoundPathItems
31
CompoundPathItems
A collection of
CompoundPathItem
objects.
Creates a new
CompoundPathItem
Gets an element from the collection.
removeAll
Deletes all elements in this collection.
HAPTER
1: JavaScript Object Reference
HAPTER
1: JavaScript Object Reference
HAPTER
1: JavaScript Object Reference
Datasets
34
Read-only. The name of the obje
HAPTER
1: JavaScript Object Reference
35
Document
An Illustrator document. Documents are contained in the
Application
object.
open
for more information on how
document color spaces are handled.
Document properties
Property
Value type
What it is
The currently opened dataset.
activeLayer
Layer
The active layer in the document.
activeView
View
Read-only. The documents current view.
artboards
Artboards
Read-only. All artboards in the document.
brushes
Brushes
Read-only. The brushes contained in the
document.
characterStyles
CharacterStyles
Read-only. The list of character styles in this
document.
compoundPathItems
CompoundPathItems
Read-only. The compound path items
contained in the document.
cropBox
array
of 4 numbersThe boundary of the documents cropping box
for output, or
The style of the documents cropping box.
The color to use to fill new paths if
defaultFilled
true
defaultFilled
boolean
If
true
, a new path should be filled.
defaultFillOverprint
boolean
If
true
, the art beneath a filled object should
be overprinted by default.
defaultStrokeCap
StrokeCap
Default type of line capping for paths created.
defaultStrokeColor
Color
The stroke color for new paths if default
stroked is
defaultStroked
boolean
If
true
, a new path should be stroked.
HAPTER
1: JavaScript Object Reference
36
defaultStrokeDashes
object
Default lengths for dashes and gaps in dashed
lines, starting with the first dash length,
Default type of joints in new paths.
defaultStrokeMiterLimit
number (double)
Read-only. The color specification system to
use for this documents color space.
fullName
File
Read-only. The file associated with the
Read-only. The gradients contained in the
document.
graphicStyles
GraphicStyles
Read-only. The graphic styles defined in this
document.
graphItems
GraphItems
Read-only. The graph art items in this
document.
groupItems
GroupItems
Read-only. The group items contained in the
document.
height
number (double)
Read-only. The height of the document.
inkList
object
Read-only. The list of
inks in this document.
HAPTER
1: JavaScript Object Reference
37
layers
Layers
Read-only. The layers contained in the
document.
legacyTextItems
LegacyTextItems
Read-only. The legacy text items in the
document.
meshItems
MeshItems
Read-only. The mesh art items contained in the
document.
Read-only. The non-native art items in this
document.
outputResolution
number (double)
Read-only. The current
output resolution for
the document in dots per inch (dpi).
pageItems
PageItems
Read-only. The page items (all art item classes)
contained in the document.
pageOrigin
array
of 2 numbersThe zero-point of the page in the document
without margins, relative to the overall height
paragraphStyles
ParagraphStyles
Read-only. The list of paragraph styles in this
document.
parent
Application
Read-only. The application that contains this
document.
path
File
Read-only. The file associated with the
Read-only. The path items contained in this
document.
patterns
Patterns
Read-only. The patterns contained in this
document.
placedItems
PlacedItems
Read-only. The placed items contained in this
document.
pluginItems
PluginItems
Read-only. The plug-in items contained in this
document.
printTiles
boolean
Read-only. If
printed as tiled output.
The documents raster effect settings.
PropertyValue typeWhat it is
HAPTER
1: JavaScript Object Reference
38
rasterItems
RasterItems
Read-only. The raster it
ems contained in this
document.
rulerOrigin
array
of 2 numbersThe zero-point of the rulers in the document
relative to the bottom left of the document.
rulerUnits
RulerUnits
Read-only. The default measurement units for
the rulers in the document.
saved
boolean
If
true
, the document has not been changed
since last time it was saved.
selection
array
of objectsReferences to the objects in this documents
current selection, or
selected.
A reference to an insertion point is returned
when there is an active insertion point in the
contents of a selected text art item. Similarly, a
reference to a range of text is returned when
characters are selected in the contents of a text
art item.
showPlacedImages
boolean
Read-only. If
, placed images should be
displayed in the document.
splitLongPaths
boolean
Read-only. If
, long paths should be split
when printing.
spots
Spots
Read-only. The spot colo
rs contained in this
document.
stationery
boolean
Read-only. If
, the file is a stationery file.
stories
Stories
Read-only. The story items in this document.
swatches
Swatches
Read-only. The swatches in this document.
swatchGroups
SwatchGroups
Read-only. The swatch groups in this
document.
symbolItems
SymbolItems
Read-only. The art items in the document
linked to symbols.
symbols
Symbols
Read-only. The symbol
s in this document.
tags
Tags
Read-only. The tags
in this document.
textFrames
TextFrameItems
Read-only. The text frames in this document.
tileFullPages
boolean
Read-only. If
when printing this document.
typename
string
Read-only. Read-only. The class name of the
referenced object.
PropertyValue typeWhat it is
HAPTER
1: JavaScript Object Reference
39
Read-only. The variables defined in this
document.
variablesLocked
boolean
If
true
, the variables are locked.
views
Views
Read-only. The views contained in this
document.
visibleBounds
array
of 4 numbersRead-only. The visible bounds of the
document, including stroke width of any
objects in the illustration.
width
number (double)
Read-only. The width of this document.
XMPString
string
Method
Parameter type
ReturnsWhat it does
activate
NothingBrings the first window
associated with the
document to the front.
([layoutStyle])
DocumentLayoutStyle
BooleanArranges multiple
documents in the given
layout style.
([saveOptions])
SaveOptions
NothingCloses a document using
specified save options.
When you close a document,
CoordinateSystem
Converts the given point
between artboard and
document coordinate
systems. Returns the
converted point coordinates.
HAPTER
1: JavaScript Object Reference
40
exportFile
(exportFile,
exportFormat
[,options])
ExportType
variant
NothingExports the document to the
predefined export file
formats. The appropriate file
extension is automatically
appended to the file name,
except for Photoshop®
documents. For these, you
must include the file
extension (PSD) in the file
NothingCaptures the artwork content
within the clipping
boundaries in this document
as a raster image, and writes
the image data to a specified
file.
HAPTER
1: JavaScript Object Reference
41
importParagraphStyles
(fileSpec)File
NothingLoads the paragraph styles
from the Illustrator file.
NothingPrints the document.
rasterize
(sourceArt
[, clipBounds]
[, options])
variant
RasterizeOptions
RasterItem
Rasterizes the source art(s)
within the specified clip
bounds. The source art(s) is
disposed of as a result of the
rasterization.
rearrangeArboards
([artboardLayout,
artboardRowsOrCols,
artboardSpacing,
artboardMoveArtwork])
DocumentArtboardLayout
integer
Number
boolean
Rearranges artboards in the
document. All arguments are
optional. Default layout style
DocumentArtboard
Layout.GridByRow
The second argument
specifies the number of rows
or columns, as appropriate
for the chosen layout style, in
the range
[1..docNumArtboards-1]
or 1 (the default) for single
row/column layouts.
Spacing is a number of pixels,
default 20.
When last argument is true
(the default), artwork is
moved with the artboards.
MethodParameter typeReturnsWhat it does
HAPTER
1: JavaScript Object Reference
42
Deselecting all objects in the current document
The frontmost document can be referred to as either
activeDocument
documents[0]
var docRef = activeDocument;
docRef.selection = null;
Closing a document
// Closes the active document without saving changes
if ( app.documents.l�ength 0 ) {
aiDocument = app.activeDocument;
aiDocument.close( SaveOptions.DONOTSAVECHANGES );
aiDocument = null;
Creating a document with defaults
// Creates a new document if none exists
NothingSaves the document in it
current location.
(saveIn
[, options])
SaveOptions
NothingSaves the document in the
specified file as an Illustrator,
EPS, or PDF file.
selectObjectsOnActiveArtboard
Selects the objects on the
currently active artboard.
Returns
on success.
string
booleanSelects a predefined preset to
define grid for the current
HAPTER
1: JavaScript Object Reference
43
HAPTER
1: JavaScript Object Reference
addDocument
The layout of artboards in the new
document. Default:
GridByRow
artboardRowsOrCols
number (long)
The number of rows (for rows layout) or
columns (for column layout) of artboards.
Range: 1 to (
numArtboards
- 1) or 1 for
single row or column layouts. Default: 1
artboardSpacing
number (double)
The spacing between artboards in the new
document. Default: 20.0
colorMode
DocumentColorSpace
The color space for the new document.
height
number (double)
The height in document points.
Default:792.0
numArtboards
number (long)
The number of artboards for the new
document. Range: 1 to 100. Default:1
previewMode
DocumentPreviewMode
The preview mode for the new document.
rasterResolution
DocumentRasterResolution
The raster resolution for the new document.
title
string
The document title.
transparencyGrid
DocumentTransparencyGrid
The transparency grid color for the new
document.
typename
string
Read-only. The class name of the referenced
object.
units
RulerUnits
The ruler units for the new document.
width
number (double)
The width in document points.
Default:612.0
HAPTER
1: JavaScript Object Reference
Documents
45
Documents
A collection of
Document
objects.
Documents properties
Documents methods
Creating a new document
// Creates a new document with an RGB color space
app.documents.add( DocumentColorSpace.RGB );
PropertyValue typeWhat it is
length
Read-only. The number of objects in the collection.
parent
objectRead-only. The parent of this object.
typename
Read-only. The class name of the referenced object.
number (double)
number (double)
number (long)
DocumentArtboardLayout
number (double)
number (long)
Document
Creates a new document
parameters and returns a
reference to the new
document.
addDocument
boolean
Document
Creates a document
Gets an element from
the collection.
HAPTER
1: JavaScript Object Reference
EPSSaveOptions
46
EPSSaveOptions
Options for saving a document as an
Illustrator EPS file, used with the
method. All properties are
optional.
EPSSaveOptions properties
Property
Value type
What it is
artboardRange
string
If
saveMultipleArtboards
true
Specifies the version of the EPS file
format to save. Default:
Compatibility.ILLUSTRATOR17
compatibleGradientPrinting
boolean
If
, create a raster item of the
gradient or gradient mesh so that
PostScript Level 2 printers can print the
object. Default:
false
embedAllFonts
boolean
If
, all fonts used by the document
should be embedded in the saved file
(version 7 or later). Default:
false
embedLinkedFiles
boolean
If
, linked image files are to be
included in the saved document.
flattenOuput
OutputFlattening
How should transparency be flattened
for file formats older than Illustrator 9.
includeDocumentThumbnails
boolean
If
, thumbnail image of the EPS
artwork should be included.
overprint
PDFOverprint
Whether to preserve, discard, or
simulate the overprint. Default:
PDFOverprint.PRESERVEPDFOVERPRINT
postScript
EPSPostScriptLevelEnum
PostScript Language Level to use
(Level1 valid for file format version 8 or
older). Default:
EPSPostScriptLevelEnum.LEVEL2
preview
EPSPreview
The format for the EPS preview image.
saveMultipleArtboards
boolean
If
, all artboards or range of
artboards are saved. Default:
false
typename
string
Read-only. The class name of the
referenced object.
HAPTER
1: JavaScript Object Reference
EPSSaveOptions
47
Exporting to EPS format
// Exports current document to destFile as an EPS file with specified
// options, destFile contains the full path including the file name
function exportFileAsEPS (destFile) {
var newFile = new File(destFile);
var saveDoc;
if ( app.documents.length == 0 )
saveDoc = app.documents.add();
else
saveDoc = app.activeDocument;
var saveOpts = new EPSSaveOptions();
saveOpts.cmykPostScript = true;
saveOpts.embedAllFonts = true;
saveDoc.saveAs( newFile, saveOpts );
HAPTER
1: JavaScript Object Reference
ExportOptionsAutoCAD
48
ExportOptionsAutoCAD
Options for exporting a document as
an AutoCAD file, used with the
exportFile
property.
ExportOptionsAutoCAD properties
Property
Value type
What it is
alterPathsForAppearance
If
, paths are altered if needed to
maintain appearance. Default:
colors
AutoCADColors
The colors exported into the
AutoCAD file.
convertTextToOutlines
If
, text is converted to vector
paths; preserves the visual
appearance of type. Default:
false
exportFileFormat
AutoCADExportFileFormat
The format to which the file is
exported. Default:
AutoCADExportFileFormat.DWG
exportOption
AutoCADExportOption
The format in which raster art is
exported.
scaleLineweights
If
, line weights are scaled by the
same scaling factor as the rest of the
drawing. Default:
typename
Read-only. The class name of the
referenced object.
unit
AutoCADUnit
The measurement units from which
to map.
HAPTER
1: JavaScript Object Reference
ExportOptionsAutoCAD
49
unitScaleRatio
number (double)
The ratio (as a percentage) by which
output is scaled. Range: 0 to 1000
version
AutoCADCompatibility
The release of AutoCAD to which the
file is exported. Default:
AutoCADCompatibility.AutoCADRe
lease24
Property
Value type
What it is
HAPTER
1: JavaScript Object Reference
ExportOptionsFlash
50
ExportOptionsFlash
Options for exporting a document as a Macr
omedia® Flash® (SWF) file, used with the
How the art should be clipped during output.
Default:
ArtClippingOption.OUTPUTARTBOUNDS
artboardRange
If
saveMultipleArtboards
The background color of the exported Flash
frames.
backgroundLayers
of
A list of layers to be
included as the static
background of the exported Flash frames.
blendAnimation
BlendAnimationType
The animation type for blended objects. Default:
BlendAnimationType.NOBLENDANIMATION
compressed
If
, the exported file should be exported
compressed. Default:
convertTextToOutlines
If
, all text is converted to vector paths;
preserves the visual appearance of type in all
Flash players. Default:
curveQuality
number (long)
The amount of curve information that should be
presented. Default: 7
exportAllSymbols
If
The style in which the exported data should be
created in Flash.
Default:
FlashExportStyle.ASFLASHFILE
exportVersion
FlashExportVersion
The version of the exported SWF file.
Default:
FlashExportVersion.FlashVersion9
frameRate
number (double)
The display rate in frames per second.
Range:0.01…120.0. Default: 12.0
HAPTER
1: JavaScript Object Reference
ExportOptionsFlash
51
Exporting to Flash format
// Exports current document to destFile as a flash file with specified
// options, destFile contains the full path including the file name
function exportToFlashFile(destFile) {
if ( app.documents.l�ength 0 ) {
var exportOptions = new ExportOptionsFlash();
var type = ExportType.FLASH;
var fileSpec = new File(destFile);
exportOptions.resolution = 150;
app.activeDocument.exportFile( fileSpec, type, exportOptions );
imageFormat
FlashImageFormat
How should the image in the exported Flash file
be compressed.
Default:
FlashImageFormat.LOSSLESS
The order in which layers are exported to Flash
frames. Default:
LayerOrderType.BOTTOMUP
looping
If
The access level for the exported SWF file.
Default:
FlashPlaybackSecurity.PlaybackLocal
preserveAppearance
If
, preserve appearance. If
false
, preserve
editability. Default:
readOnly
If
, export as read-only file. Default:
replacing
SaveOptions
If a file with the same name already exists, should
it be replaced.
Default:
SaveOptions.PROMPTTOSAVECHANGES
resolution
number (double)
The resolution in pixels per inch. Range: 72…2400.
Default: 72
saveMultipleArtboards
If
, all artboards or range of artboards are
saved. Default:
typename
Read-only. The class name of the referenced
object.
PropertyValue typeWhat it is
HAPTER
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
ExportOptionsGIF properties
Property
Value type
What it is
antiAliasing
If
, the exported image sh
ould be anti-aliased.
artBoardClipping
If
, the exported image should be clipped to the
art board. Default:
false
colorCount
number (long)
The number of colors in the exported images color
table. Range: 2 to 256. Default: 128
colorDither
The method used to dither colors in the exported
image. Default:
The color to use when matting the art board.
saveAsHTML
If
, the exported image should be saved with an
accompanying HTML file. Default:
transparency
If
, the exported image should use transparency.
typename
Read-only. The class name
of the referenced object.
HAPTER
1: JavaScript Object Reference
ExportOptionsGIF
53
Exporting to GIF format
// Exports current document to dest as a GIF file with specified
// options, dest contains the full path including the file name
function exportToGIFFile(dest) {
if ( app.documents.l�ength 0 ) {
var exportOptions = new ExportOptionsGIF();
var type = ExportType.GIF;
var fileSpec = new File(dest);
exportOptions.antiAliasing = false;
exportOptions.colorCount = 64;
HAPTER
1: JavaScript Object Reference
ExportOptionsJPEG
54
ExportOptionsJPEG
Options for exporting a document as a JPEG file, used with the
exportFile
The color to use when matting the art board.
optimization
boolean
true
, the exported image should be optimized for web
viewing. Default:
HAPTER
1: JavaScript Object Reference
ExportOptionsJPEG
55
Exporting to JPEG format
// Exports current document to dest as a JPEG file with specified
// options, dest contains the full path including the file name
HAPTER
1: JavaScript Object Reference
ExportOptionsPhotoshop
56
ExportOptionsPhotoshop
Options for exporting a document as a Photoshop file, used with the
The color space of the exported file.
ImageColorSpace.RGB
maximumEditability
boolean
Preserve as much of the or
iginal documents structure
as possible when exporting. Default:
resolution
number (double)
Resolution of the exported file in dots per inch (dpi).
Range: 72.0 to 2400.0. Default: 150.0
saveMultipleArtboards
boolean
If
true
, all artboards or range of artboards are saved.
typename
string
Read-only. The class name
of the referenced object.
warnings
boolean
If
true
, a warning dialog should be displayed in case
HAPTER
1: JavaScript Object Reference
ExportOptionsPhotoshop
57
Exporting to Photoshop format
// Exports current document to dest as a PSD file with specified
// options, dest contains the full path including the file name
HAPTER
1: JavaScript Object Reference
ExportOptionsPNG8
58
ExportOptionsPNG8
Options for exporting a document as
an 8-bit PNG file, used with the
exportFile
The method used to dither colors in the exported
image. Default:
The method used to reduce
the number of colors in
the exported image.
The color to use when matting the art board.
saveAsHTML
boolean
If
true
, the exported image be saved with an
accompanying HTML file. Default:
false
transparency
boolean
If
true
, the exported image use transparency.
typename
string
Read-only. The class name
of the referenced object.
HAPTER
1: JavaScript Object Reference
ExportOptionsPNG8
59
Exporting to PNG8 format
// Exports current document to dest as a PNG8 file with specified
// options, dest contains the full path including the file name
HAPTER
1: JavaScript Object Reference
ExportOptionsPNG24
60
ExportOptionsPNG24
Options for exporting a document as
a 24-bit PNG file, used with the
exportFile
The color to use when matting the art board.
Default:
white
saveAsHTML
boolean
If
, the exported image be saved with an
accompanying HTML file. Default:
transparency
boolean
If
, the exported image use transparency.
Default:
true
typename
string
Read-only. The class name of the referenced object.
verticalScale
number (double)
The vertical scaling factor to apply to the exported
image, where 100.0 is 100. Default: 100.0
HAPTER
1: JavaScript Object Reference
ExportOptionsSVG
61
ExportOptionsSVG
Options for exporting a document as a SVG file, used with the
exportFile
How the CSS properties of the
exported file. Default:
SVGCSSPropertyLocation.
STYLEATTRIBUTES
documentEncoding
SVGDocumentEncoding
How the text in the document should
be encoded. Default:
SVGDocumentEncoding.ASCII
SVGDTDVersion
The SVG version to which the file
should conform. Default:
SVGDTDVersion.SVG1_1
embedRasterImages
boolean
If
true
, the raster images contained in
the document should be embedded
in the exported file. Default:
Which font glyphs should be included
in the exported file. Default:
The type of font to included in the
exported file.
SVGFontType.CEFFONT
includeFileInfo
boolean
If
, file information should be
saved in the exported file.
HAPTER
1: JavaScript Object Reference
ExportOptionsSVG
62
Exporting to SVG format
// Exports current document to dest as an SVG file with specified
// options, dest contains the full path including the file name
HAPTER
1: JavaScript Object Reference
ExportOptionsTIFF
63
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
ExportOptionsTIFF properties
Exporting to TIFF format
// Exports current document to dest as a TIFF file with specified
// options, dest contains the full path including the file name
The byte order to use in the new file.
imageColorSpace
ImageColorSpace
The color space of the exported file.
ImageColorSpace.RGB
IZWCompression
boolean
If
true
, use IZW compression in the new file.
resolution
number (double)
Resolution of the exported file in dots per inch (dpi).
Range: 72.0 to 2400.0. Default: 150.0
saveMultipleArtboards
boolean
If
true
, all artboards or range of artboards are saved.
HAPTER
1: JavaScript Object Reference
FXGSaveOptions
64
FXGSaveOptions
Specifies options which may be supplied when saving
a document as an FXG file. All properties are
optional.
FXGSaveOptions properties
Property
Value type
What it is
artboardRange
string
If
saveMultipleArtboards
true
The policy used by FXG to expand
blends. Default:
BlendsExpandPolicy.AUTOMATICA
LLYCONVERTBLENDS
downsampleLinkedImages
boolean
If
true
, linked images are
downsampled (at 72 dpi).
filtersPolicy
FiltersPreservePolicy
The policy used by FXG to preserve
filters. Default:
FiltersPreservePolicy.
KEEPFILTERSEDITABLE
gradientsPolicy
GradientsPreservePolicy
The policy used by FXG to preserve
gradients. Default:
GradientsPreservePolicy.
AUTOMATICALLYCONVERTGRADIENTS
includeUnusedSymbols
boolean
If
true
, unused symbols are
included. Default:
preserveEditingCapabilities
boolean
If
true
, the editing capabilities of
FXG are preserved. Default:
true
saveMultipleArtboards
boolean
If
true
, all artboards or range of
artboards are saved. Default:
false
textPolicy
TextPreservePolicy
The policy used by FXG to preserve
text. Default:
AUTOMATICALLYCONVERTTEXT
version
FXGVersion
The version of the FXG file format to
create. Default
FXGVersion.VERSION2PT0
HAPTER
1: JavaScript Object Reference
65
Gradient
A gradient definition contained in a do
cument. Scripts can create new gradients.
Gradient properties
Read-only. The gradient stops
contained in this gradient.
name
The gradients name.
parent
Read-only. The document that contains this gradient.
type
GradientType
The kind of the gradient, either radial or linear.
typename
Read-only. The class name
of the referenced object.
HAPTER
1: JavaScript Object Reference
66
// Modify the last gradient stop
newGradient.gradientStops[1].rampPoint = 80;
newGradient.gradientStops[1].color = endColor;
// construct an Illustrator.GradientColor object referring to the
// newly created gradient
var colorOfGradient = new GradientColor();
colorOfGradient.gradient = newGradient;
HAPTER
1: JavaScript Object Reference
GradientColor
67
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
Changing a gradient stop color
// Creates a new RGB document, then changes the color
// of the first gradient stop of an indexed gradient
app.documents.add(DocumentColorSpace.RGB);
Reference to the object defining the gradient.
hiliteAngle
number (double)
The gradient highlight vector angle in degrees.
hiliteLength
number (double)
The gradient highlight vector length.
length
number (double)
The gradient vector length.
matrix
Matrix
An additional transformation matrix to manipulate the
gradient path.
origin
array
of 2 numbersThe gradient vector origin
, the center point of the gradient in
this color.
typename
string
Read-only. The class name of the referenced object.
HAPTER
1: JavaScript Object Reference
68
Gradients
A collection of
Gradient
objects in a document.
Gradients properties
Creates a new
Gradient
object.
HAPTER
1: JavaScript Object Reference
69
GradientStop
A gradient stop definition that represents a point on
a specific gradient defi
ned in the document. Each
gradient stop specifies a color chan
ge in the containing gradient. See
Changing a gradient stop color
for
an example.
GradientStop properties
The color linked to this gradient stop.
midPoint
number (double)
The midpoint key value, specified
as a percentage from 13.0 to
87.0.
opacity
number (double)
The opacity value for the gradient stop. Range: 0.0 to100.0
parent
Gradient
Read-only. The gradient that
contains this gradient stop.
rampPoint
number (double)
The location of the color in the blend in a range from 0.0 to 100.0,
where 100.0 is 100%.
typename
string
Read-only. The class name of the referenced object.
HAPTER
1: JavaScript Object Reference
70
GradientStops
A collection of
GradientStop
objects in a specific gradient. The el
ements are not named; you must access
them by index.
GradientStops properties
Creates a new object.
Gets the first element in the collection
with the specified name.
index
(itemKey)number
GradientStop
HAPTER
1: JavaScript Object Reference
71
HAPTER
1: JavaScript Object Reference
GraphicStyle
72
GraphicStyle
A graphic style. Each graphic style defines a se
t of appearance attributes that you can apply
non-destructively to page items. Graphic styles ar
e contained in documents. Scripts cannot create new
graphic styles.
GraphicStyle properties
Read-only. The document that contains this graphic style.
typename
Read-only. The class name of the referenced object.
NothingApplies this art style to a specified art item.
NothingMerges this art style into the current styles of a specified
art item.
remove
HAPTER
1: JavaScript Object Reference
73
GraphicStyles
A collection of
GraphicStyle
objects in a document.
GraphicStyles properties
MethodParameter type:ReturnsWhat it does
HAPTER
1: JavaScript Object Reference
74
GraphItem
Any graph artwork object. See example
Rotating graph items
below.
GraphItem properties
Property
Value typeWhat it is
artworkKnockout
KnockoutState
Is this object used to create a knockout, and if so, what
The mode used when compositing an object.
contentVariable
Variable
The content variable bound to the graph item.
Read-only. The layer to which this graph item belongs.
left
number
The offset (in points) of the left side of the graph item
from the left side of the page.
locked
boolean
If
true
, this graph item is locked.
name
string
The name of this graph item.
note
string
The note assigned to this item.
opacity
number(double)
GroupItem
Read-only. The parent of this object.
position
of 2 numbersThe 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:
HAPTER
1: JavaScript Object Reference
75
Read-only. The tags contai
ned in this graph item.
number (double)
Method
GraphItem
Creates a duplicate of the
selected object.
(relativeObject,
insertionLocation)
object
ElementPlacement
GraphItem
Moves the object.
HAPTER
1: JavaScript Object Reference
76
(scaleX,
scaleY
[,changePositions]
[,changeFillPatterns]
[,changeFillGradients]
[,changeStrokePattern]
[,changeLineWidths]
[,scaleAbout])
number (double)
number (double)
number (double)
Transformation
NothingScales the art item where
is the horizontal
scaling factor and
scaleY
the vertical scaling factor.
100.0 = 100%.
(angle
[,changePositions]
[,changeFillPatterns]
[,changeFillGradients]
[,changeStrokePattern]
[,rotateAbout])
number (double)
Transformation
NothingRotates the art item relative
to the current rotation. The
object is rotated
counter-clockwise if the
value is positive,
clockwise if the value is
negative.
transform
(transformationMatrix
[,changePositions]
[,changeFillPatterns]
[,changeFillGradients]
[,changeStrokePattern]
[,changeLineWidths]
[,transformAbout])
number (double)
Transformation
NothingTransforms the art item by
applying a transformation
matrix.
translate
([deltaX]
[,deltaY]
[,transformObjects]
[,transformFillPatterns]
[,transformFillGradients]
[,transformStrokePatterns])
number (double)
number (double)
NothingRepositions the art item
relative to the current
position, where
deltaX
NothingArranges the art items
position in the stacking order
of the group or layer (parent)
of this object.
HAPTER
1: JavaScript Object Reference
GraphItems
77
GraphItems
A collection
GraphItems
objects, which gives you access to all the graph art items in an Illustrator
document.
GraphItems properties
HAPTER
1: JavaScript Object Reference
78
GrayColor
A grayscale color specification, used where a
object is required.
GrayColor properties
Changing a color to gray
HAPTER
1: JavaScript Object Reference
79
GroupItem
Is this object used to create a knockout, and if so,
what kind of knockout.
blendingMode
BlendModes
The blend mode used when compositing an object.
clipped
If
, the group is clipped to the clipping mask.
compoundPathItems
CompoundPathItems
Read-only. The compound path items contained in
this group.
controlBounds
of 4 numbersRead-only. The bounds of the object including stroke
width and controls.
editable
Read-only. If
, this item is editable.
Read-only. The graph items
contained in this group.
groupItems
GroupItems
Read-only. The group items contained in this group.
height
number (double)
The height of the group item.
hidden
If
, this group item is hidden.
isIsolated
If
, this object is isolated.
layer
Read-only. The layer to which this group item
belongs.
left
number (double)
The position of the left side of the item (in points,
measured from the left side of the page).
legacyTextItems
LegacyTextItems
Read-only. The legacy text items in the group.
locked
If
, this group item is locked.
meshItems
MeshItems
Read-only. The mesh items contained in this group.
name
The name of this group item.
nonNativeItems
NonNativeItems
Read-only. The non-native art items in this group.
HAPTER
1: JavaScript Object Reference
80
note
The note assigned to this item.
opacity
number (double)
The opacity of the object. Range: 0.0 to 100.0
pageItems
PageItems
Read-only. The page items (all art item classes)
contained in this group.
parent
GroupItem
Read-only. The parent of this object.
pathItems
PathItems
Read-only. The path items contained in this group.
placedItems
PlacedItems
Read-only. The placed items contained in this group.
pluginItems
PluginItems
Read-only. The plug-in items contained in this group.
position
of 2 numbersThe position (in points) of the top left corner of the
groupItem
object in the format [x, y]. Does not
include stroke weight.
rasterItems
RasterItems
Read-only. The raster items contained in this group.
selected
If
, this group item is selected.
sliced
If
, the item sliced. Default:
symbolItems
SymbolItems
Read-only. The symbol item objects in this group.
tags
Read-only. The tags contained in this group.
textFrames
TextFrameItems
Read-only. The text art item
s contained in this group.
number (double)
The position of the top of the item (in points,
measured from the bottom of the page).
typename
Read-only. The class name of the referenced object.
The value of the Adobe URL tag assigned to this
group item.
visibilityVariable
The visibility variable bound to the item.
visibleBounds
of 4 numbersRead-only. The visible bounds of the group item
including stroke width.
width
number (double)
The width of the group item.
wrapInside
If
, the text frame object should be wrapped
inside this object.
HAPTER
1: JavaScript Object Reference
81
GroupItem
Creates a duplicate of the
selected object.
move
(relativeObject,
insertionLocation)
object
ElementPlacement
GroupItem
Moves the object.
remove
NothingScales the art item where
is the horizontal
scaling factor and
is the vertical scaling factor.
100.0 = 100%.
rotate
(angle
[,changePositions]
[,changeFillPatterns]
[,changeFillGradients]
[,changeStrokePattern]
[,rotateAbout])
number (double)
boolean
boolean
boolean
boolean
Transformation
NothingRotates the art item relative
to the current rotation. The
object is rotated
counter-clockwise if the
value is positive,
clockwise if the value is
negative.
transform
(transformationMatrix
[,changePositions]
[,changeFillPatterns]
[,changeFillGradients]
[,changeStrokePattern]
[,changeLineWidths]
[,transformAbout])
boolean
boolean
boolean
boolean
number (double)
Transformation
NothingTransforms the art item by
applying a transformation
translate
([deltaX]
[,deltaY]
[,transformObjects]
[,transformFillPatterns]
[,transformFillGradients]
[,transformStrokePatterns])
number (double)
number (double)
boolean
boolean
boolean
boolean
NothingRepositions the art item
relative to the current
position, where
NothingArranges the art items
position in the stacking
order of the group or layer
(parent) of this object.
HAPTER
1: JavaScript Object Reference
82
Modifying all objects in a group
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
HAPTER
1: JavaScript Object Reference
83
GroupItems
The collection of grouped art items in a document.
GroupItems properties
Method
Creates a new object.
createFromFile
(imageFile)File
GroupItem
Places an external vector art file as a group
item in the document.
HAPTER
1: JavaScript Object Reference
IllustratorSaveOptions
84
IllustratorSaveOptions
Options for saving a document as an Illustrator file, used with the
saveAs
Specifies the version of Illustrator file format to create.
Compatibility.ILLUSTRATOR17
compressed
boolean
(Illustrator version 10 or later.) If
, the saved file is
compressed. Default:
true
embedICCProfile
boolean
(Illustrator version 9 or later.) If
true
, the documents
ICC profile is embedded in the saved file.
embedLinkedFiles
boolean
(Illustrator version 7 or later.) If
files is embedded in the saved file. Default:
false
flattenOutput
OutputFlattening
(Versions before Illustrator 9.) How transparency
should be flattened for ol
der file format versions.
OutputFlattening.PRESERVEAPPEARANCE
HAPTER
1: JavaScript Object Reference
IllustratorSaveOptions
85
Saving with options
// Saves the current document to dest as an AI file with specified options,
// dest specifies the full path and file name of the new file
HAPTER
1: JavaScript Object Reference
ImageCaptureOptions
86
ImageCaptureOptions
Options for image capture, used with the
The color to use for the artboard matte. Default:
resolution
number (double)
The resolution of the captured image file in points-per-inch
(PPI), in the range [72.
0 ... 2400.0]. Default: 150
transparency
boolean
If
, the image result is transparent. Default:
typename
Read-only. The class name of the referenced object.
HAPTER
1: JavaScript Object Reference
87
Associates a document ink name with ink information.
Ink properties
PropertyValue typeWhat it is
inkInfo
InkInfo
The ink information
name
string
The inks name
typename
string
Read-only. The class name of the object
HAPTER
1: JavaScript Object Reference
InkInfo
88
InkInfo
Ink information for printing a document.
InkInfo properties
The color of the custom ink.
density
number (double)
The neutral density. Minimum: 0.0
dotShape
string
The dot shape name.
frequency
number (double)
The inks frequency. Range: 0.0 to 1000.0
kind
InkType
The ink type.
printingStatus
InkPrintStatus
The ink printing status.
trapping
TrappingType
The trapping type.
trappingOrder
number (long)
The order of trapping for the ink. Range: 1 to 4 for CMYK
typename
string
Read-only. The class name of the object.
HAPTER
1: JavaScript Object Reference
InsertionPoint
89
InsertionPoint
Read-only. All the characters in this text range.
lines
Lines
Read-only. All the lines in this text range.
paragraphs
Paragraphs
Read-only. All the paragraphs in this text range.
parent
TextRange
Read-only. The objects container.
story
Story
Read-only. The story to which the text range
belongs.
textRanges
TextRanges
Read-only. All of the text in this text range.
typename
string
Read-only. The class name o f the object.
words
Words
Read-only. All the words contained in this text
range.
HAPTER
1: JavaScript Object Reference
InsertionPoints
90
InsertionPoints
A collection of
InsertionPoint
objects.
InsertionPoints properties
HAPTER
1: JavaScript Object Reference
LabColor
91
LabColor
A color specification in the CIE Lab color space, used where a
color
object is required.
LabColor properties
PropertyValue typeWhat it is
number (double)
The a (red-green) color value. Range -128.0…128.0. Default: 0.0
number (double)
The b (yellow-blue) color value.
Range -128.0…128.0. Default: 0.0
number (double)
The l (lightness) color value. Range -128.0…128.0. Default: 0.0
HAPTER
1: JavaScript Object Reference
92
Layer
A layer in an Illustrator document. Layers may contain
nested layers, which are called sublayers in the user
interface.
object contains all of the page items in the sp
ecific layer as elements. Your script can access
page items as elements of either the
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
Property
Value typeWhat it is
artworkKnockout
KnockoutState
Is this object used to create a knockout, and if so, what
The mode used when compositing an object.
color
RGBColor
The layers selection mark color.
compoundPathItems
CompoundPathItems
Read-only. The compound path
items contained in this
layer.
dimPlacedImages
boolean
If
, placed images should be
rendered as dimmed in
this layer.
graphItems
GraphItems
Read-only. The graph items contained in this layer.
groupItems
GroupItems
Read-only. The group items contained in this layer.
hasSelectedArtwork
boolean
If
true
Read-only. The layers contained in this layer.
legacyTextItems
LegacyTextItems
Read-only. The legacy text items in this layer.
locked
boolean
If
true
Read-only. The mesh items contained in this layer.
name
The name of this layer.
nonNativeItems
NonNativeItems
The non-native art items in this layer.
opacity
number (double)
The opacity of the layer. Range: 0.0 to 100.0
pageItems
PageItems
Read-only. The page items (all art item classes)
contained in this layer.
parent
Document
Layer
Read-only. The document or layer that contains this
layer.
HAPTER
1: JavaScript Object Reference
93
Read-only. The path items contained in this layer.
placedItems
PlacedItems
Read-only. The placed items contained in this layer.
pluginItems
PluginItems
Read-only. The plug-in items contained in this layer.
preview
boolean
If
true
, this layer should be displayed using preview
mode.
printable
boolean
If
true
, this layer should be printed when printing the
document.
rasterItems
RasterItems
Read-only. The raster item
s contained in this layer.
sliced
boolean
If
true
, the layer item is sliced. Default:
false
symbolItems
SymbolItems
Read-only. The symbol items contained in the layer.
textFrames
TextFrameItems
Read-only. The text art items contained in this layer.
typename
Read-only. The class name
of the referenced object.
visible
boolean
If
true
, this layer is visible.
zOrderPosition
number (long)
Read-only. The position of this layer within the stacking
order of layers in the document.
PropertyValue typeWhat it is
Moves the object.
remove
NothingArranges the layers position in the
stacking order of the containing layer or
document (
parent
) of this object
HAPTER
1: JavaScript Object Reference
94
Bringing a layer to the front
// Moves the bottom layer to become the topmost layer
if (documents.le�ngth 0) {
countOfLayers = activeDocument.layers.length;
if (countOfLayers � 1) {
bottomLayer = activeDocument.layers[countOfLayers-1];
HAPTER
1: JavaScript Object Reference
Layers
95
Layers
The collection of layers in the document.
Layers properties
Layers methods
Creates a new layer in the document.
Gets an element from the collection.
removeAll
HAPTER
1: JavaScript Object Reference
LegacyTextItem
96
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
Property
Value type
What it is
artworkKnockout
KnockoutState
Is this object used to create a knockout, and if so, what
kind of knockout.
blendingMode
BlendModes
The blend mode used when compositing an object.
controlBounds
of 4 numbersRead-only. The bounds of the object including stroke
width and controls.
converted
Read-only. If
, the legacy text item has been
updated to a native text frame item.
editable
Read-only. If
, this item is editable.
Read-only. The layer to which this item belongs.
left
number (double)
The position of the left side of the item (in points,
measured from the left side of the page).
locked
If
, this item is locked.
name
The name of this item.
note
The note assigned to this item.
opacity
number (double)
The opacity of the object. Range: 0.0 to 100.0
parent
GroupItem
Read-only. The parent of this object.
position
of 2 numbersThe position (in points) of the top left corner of the
legacyTextItem
object in the format [x, y]. Does not
include stroke weight.
selected
If
, this item is selected.
sliced
If
, the item sliced. Default:
tags
Read-only. The tags contained in this item.
HAPTER
1: JavaScript Object Reference
LegacyTextItem
97
LegacyTextItem methods
number (double)
The position of the top of the item (in points,
measured from the bottom of the page).
typename
Read-only. The class name of the referenced object.
The value of the Adobe URL tag assigned to this item.
visibilityVariable
Variable
The visibility variable bound to the item.
visibleBounds
of 4 numbersRead-only. The visible bounds of the item including
stroke width.
width
number (double)
The width of the item.
wrapInside
If
, the text frame object should be wrapped
inside this object.
Converts the legacy
text item to a text
frame and deletes the
original legacy text.
duplicate
([relativeObject]
[,insertionLocation])
object
ElementPlacement
LegacyTextItem
Creates a duplicate of
the selected object.
move
(relativeObject,
insertionLocation)
object
ElementPlacement
LegacyTextItem
Moves the object.
remove
HAPTER
1: JavaScript Object Reference
LegacyTextItem
98
resize
(scaleX,
[,changePositions]
[,changeFillPatterns]
[,changeFillGradients]
[,changeStrokePattern]
[,changeLineWidths]
[,scaleAbout])
number (double)
number (double)
boolean
boolean
boolean
boolean
number (double)
Transformation
NothingScales the art item
where
scaleX
horizontal scaling
factor and
scaleY
the vertical scaling
factor. 100.0 = 100%.
rotate
(angle
[,changePositions]
[,changeFillPatterns]
[,changeFillGradients]
[,changeStrokePattern]
[,rotateAbout])
number (double)
boolean
boolean
boolean
boolean
Transformation
NothingRotates the art item
relative to the current
rotation. The object is
rotated
counter-clockwise if
value is
positive, clockwise if
the value is negative.
transform
(transformationMatrix
[,changePositions]
[,changeFillPatterns]
[,changeFillGradients]
[,changeStrokePattern]
[,changeLineWidths]
[,transformAbout])
Matrix
boolean
boolean
boolean
boolean
number (double)
Transformation
NothingTransforms the art
item by applying a
transformation matrix.
translate
([deltaX]
[,deltaY]
[,transformObjects]
[,transformFillPatterns]
[,transformFillGradients]
[,transformStrokePatterns])
number (double)
number (double)
boolean
boolean
boolean
boolean
NothingRepositions the art
item relative to the
current position,
where
deltaX
NothingArranges the art items
stacking order of the
group or layer (parent)
of this object.
HAPTER
1: JavaScript Object Reference
LegacyTextItems
99
LegacyTextItems
A collection of
LegacyTextItem
objects.
LegacyTextItems properties
HAPTER
1: JavaScript Object Reference
100
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
HAPTER
1: JavaScript Object Reference
Matrix
101
Matrix
HAPTER
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
Is this object used to create a knockout, and if so, what
kind of knockout.
blendingMode
BlendModes
The blend mode used when
compositing an object.
controlBounds
array
of 4 numbersRead-only. The bounds of the object including stroke
width and controls.
editable
boolean
Read-only. If
true
, this item is editable.
Read-only. The layer to which this item belongs.
left
number (double)
The position of the left side of the item (in points,
measured from the left side of the page).
locked
boolean
If
true
, this item is locked.
name
string
The name of this item.
note
string
The note assigned to this item.
opacity
number (double)
The opacity of the object. Range: 0.0 to 100.0
parent
Layer
GroupItem
Read-only. The parent of this object.
position
array
of 2 numbersThe 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 co
ntained in this item.
number (double)
The position of the top of the item (in points, measured
from the bottom of the page).
HAPTER
1: JavaScript Object Reference
MeshItem
103
MeshItem
Creates a duplicate of the
selected object.
move
(relativeObject,
insertionLocation)
object
ElementPlacement
MeshItem
Moves the object.
remove
NothingScales the art item where
is the horizontal
scaling factor and
scaleY
the vertical scaling factor.
100.0 = 100%.
rotate
(angle
[,changePositions]
[,changeFillPatterns]
[,changeFillGradients]
[,changeStrokePattern]
[,rotateAbout])
number (double)
boolean
boolean
boolean
boolean
Transformation
NothingRotates the art item relative
to the current rotation. The
object is rotated
counter-clockwise if the
value is positive,
clockwise if the value is
negative.
HAPTER
1: JavaScript Object Reference
MeshItem
104
Finding and locking mesh items
// Locks all mesh items in the current document
if ( app.documents.l�ength 0 ) {
doc = app.activeDocument;
for ( i = 0; i doc.meshItems.length; i++ ) {
doc.meshItems[i].locked = true;
transform
(transformationMatrix
[,changePositions]
[,changeFillPatterns]
[,changeFillGradients]
[,changeStrokePattern]
[,changeLineWidths]
[,transformAbout])
Matrix
boolean
boolean
boolean
boolean
number (double)
Transformation
NothingTransforms the art item by
applying a transformation
matrix.
translate
([deltaX]
[,deltaY]
[,transformObjects]
[,transformFillPatterns]
[,transformFillGradients]
[,transformStrokePatterns])
number (double)
number (double)
boolean
boolean
boolean
boolean
NothingRepositions the art item
relative to the current
position, where
is the
NothingArranges the art items
position in the stacking order
of the group or layer (parent)
of this object.
HAPTER
1: JavaScript Object Reference
MeshItems
105
MeshItems
A collection of
MeshItem
objects.
MeshItems properties
HAPTER
1: JavaScript Object Reference
106
NoColor
Represents the noneŽ color. Assigning a
NoColor
object to the fill or stroke color of an art item is
HAPTER
1: JavaScript Object Reference
NonNativeItem
107
NonNativeItem
A non-native artwork item.
NonNativeItem properties
These classes inherit all properties from the
page
class.
PropertyValue typeWhat it is
artworkKnockout
KnockoutState
Is this object used to create a knockout, and if so, what
kind of knockout.
blendingMode
BlendModes
The blend mode used when
compositing an object.
controlBounds
array
of 4 numbersRead-only. The bounds
of the object including stroke
width and controls.
editable
boolean
Read-only. If
true
, this item is editable.
Read-only. The layer to which this item belongs.
left
number (double)
The position of the left side of the item (in points,
measured from the left side of the page).
locked
boolean
If
, this item is locked.
name
string
The name of this item.
note
string
The note assigned to this item.
opacity
number (double)
The opacity of the object. Range: 0.0 to 100.0
parent
Document
GroupItem
Read-only. The parent of this object.
position
array
of 2 numbersThe 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
, this item is selected.
sliced
boolean
If
, the item sliced. Default:
tags
Tags
Read-only. The tags contained in this item.
number (double)
The position of the top of the item (in points, measured
from the bottom of the page).
HAPTER
1: JavaScript Object Reference
NonNativeItem
108
NonNativeItem methods
typename
string
Read-only. The class name of the referenced object.
string
The value of the Adobe URL tag assigned to this item.
visibilityVariable
Variable
The visibility variable bound to the item.
visibleBounds
array
of 4 numbersRead-only. The visible bounds of the item including
stroke width.
width
number (double)
The width of the item.
wrapInside
boolean
If
, the non-native-item object should be wrapped
inside this object.
NonNativeItem
Creates a duplicate of
the selected object.
move
(relativeObject,
insertionLocation)
object
ElementPlacement
NonNativeItem
Moves the object.
remove
NothingScales the art item
scaleX
horizontal scaling factor
scaleY
vertical scaling factor.
100.0 = 100%.
HAPTER
1: JavaScript Object Reference
NonNativeItem
109
rotate
(angle
[,changePositions]
[,changeFillPatterns]
[,changeFillGradients]
[,changeStrokePattern]
[,rotateAbout])
number (double)
boolean
boolean
boolean
boolean
Transformation
NothingRotates the art item
relative to the current
rotation. The object is
rotated
counter-clockwise if the
angle
value is positive,
clockwise if the value is
negative.
transform
(transformationMatrix
[,changePositions]
[,changeFillPatterns]
[,changeFillGradients]
[,changeStrokePattern]
[,changeLineWidths]
[,transformAbout])
Matrix
boolean
boolean
boolean
boolean
number (double)
Transformation
NothingTransforms the art item
by applying a
transformation matrix.
translate
([deltaX]
[,deltaY]
[,transformObjects]
[,transformFillPatterns]
[,transformFillGradients]
[,transformStrokePatterns])
number (double)
number (double)
boolean
boolean
boolean
boolean
NothingRepositions the art item
relative to the current
position, where
deltaX
NothingArranges the art items
position in the stacking
order of the group or
layer (parent) of this
object.
HAPTER
1: JavaScript Object Reference
110
NonNativeItems
A collection of
NonNativeItem
objects.
NonNativeItems properties
SymbolItem
HAPTER
1: JavaScript Object Reference
OpenOptions
111
OpenOptions
Options for opening a document, used with the
Optional. Open the file as an Illustrator library of this
type. Default:
LibraryType.IllustratorArtwork
preserveLegacyArtboard
Optional. Preserve legacy artboards when opening a
legacy document in Illustrator CS4 or later. Default: true.
updateLegacyGradientMesh
If
, preserves the spot colors in the gradient mesh
objects for legacy docume
nts (pre-Illustrator CS4).
Default:
true
updateLegacyText
Optional. If
, update all legacy text items (from
previous versions of Illustrator). Default:
false
HAPTER
1: JavaScript Object Reference
OpenOptionsAutoCAD
112
OpenOptionsAutoCAD
Options for opening an AutoCAD drawing, used with the
How to scale the drawing on import. Default:
AutoCADGlobalScaleOption.FitArtboard
globalScalePercent
double
The value when
globalScaleOption
AutoCADGlobalScaleOption.ScaleByValue
expressed as a percentage. Range: 0.0 to
100.0. Default is 100.0
mergeLayers
boolean
If
true
, the layers of the artwork are merged.
parent
object
Read-only. The objects container.
scaleLineweights
boolean
If
true
, line weights are scaled by the same
factor as the rest of the drawing.
selectedLayoutName
string
The name of the layout in the drawing to
import.
typename
string
Read-only. The class name of the object.
unit
AutoCADUnit
The unit to map to.
HAPTER
1: JavaScript Object Reference
OpenOptionsFreeHand
113
OpenOptionsFreeHand
Options for opening a FreeHand file.
OpenOptionsFreeHand properties
Property
Value typeWhat it is
convertTextToOutlines
boolean
If
, all text is converted to vector paths; preserves the
visual appearance of type. Default:
importSinglePage
boolean
If
, imports only the pa
HAPTER
1: JavaScript Object Reference
OpenOptionsPhotoshop
114
OpenOptionsPhotoshop
Options for opening a Photoshop document, used with the
HAPTER
1: JavaScript Object Reference
PageItem
115
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.
Is this object used to create a knockout.
blendingMode
BlendModes
The mode to use when compositing this object. An object
Read-only. The layer to which this page item belongs.
number (double)
The left position of the art item.
locked
If
, this page item is locked.
The name of this page item.
The note assigned to this item.
opacity
The opacity of this object,
where 100.0 is completely
HAPTER
1: JavaScript Object Reference
PageItem
116
PageItem methods
selected
If
, this object is selected.
sliced
If
, preserve slices.
The collection of tags associated with this page item.
number (double)
The top position of the art item.
typename
Read-only. The class name of the object.
The value of the Adobe URL tag assigned to this page item.
visibilityVariable
anythingThe visibility variable to which this page item path is
bound.
visibleBounds
Read-only. The objects visible bounds, including stroke
width of any objects in the illustration.
width
The width of the page item, calculated from the geometric
bounds. Range: 0.0 to 16348.0
wrapInside
If
, the text frame object should be wrapped inside
this object.
NothingPlaces art object(s) in a
perspective grid at a specified
position and grid plane.
resize
(scaleX,
[,changePositions]
[,changeFillPatterns]
[,changeFillGradients]
[,changeStrokePattern]
[,changeLineWidths]
[,scaleAbout])
number (double)
number (double)
boolean
boolean
boolean
boolean
number (double)
Transformation
NothingScales art object(s).
HAPTER
1: JavaScript Object Reference
PageItem
117
rotate
(angle
[,changePositions]
[,changeFillPatterns]
[,changeFillGradients]
[,changeStrokePattern]
[,rotateAbout])
number (double)
boolean
boolean
boolean
boolean
Transformation
NothingRotates art object(s).
transform
(transformationMatrix
[,changePositions]
[,changeFillPatterns]
[,changeFillGradients]
[,changeStrokePattern]
[,changeLineWidth]
[,transformAbout])
matrix
boolean
boolean
boolean
boolean
number (double)
Transformation
NothingTransforms art object(s) using a
transformation matrix.
translate
([deltaX]
[,deltaY]
[,transformObjects]
[,transformFillPatterns]
[,transformFillGradents]
[,transformStrokePattern])
number (double)
number (double)
boolean
boolean
boolean
boolean
NothingRepositions art object(s).
zOrder
(zOrderCmd)
NothingArranges the art relative to other
art in the group or layer.
HAPTER
1: JavaScript Object Reference
PageItems
118
PageItems
GraphItem
GroupItem
LegacyTextItem
MeshItem
NonNativeItem
PathItem
PlacedItem
PluginItem
RasterItem
SymbolItem
TextFrameItem
You can reference page items through the
PageItems
property in a
Document
Layer
. 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
value of that object is
GraphItem
PageItems properties
PageItems methods
PropertyValue typeWhat it is
length
number
Read-only. The number of objects in the collection.
parent
objectRead-only. The parent of this object.
typename
string
Read-only. The class name
of the referenced object.
Gets an element from the collection.
removeAll
NothingDeletes all elements in this collection.
HAPTER
1: JavaScript Object Reference
PageItems
119
HAPTER
1: JavaScript Object Reference
120
Paper
Associates paper information with a paper name.
objects are used by
Printer
objects.
Paper properties
PropertyValue typeWhat it is
name
The paper name.
paperInfo
PaperInfo
The paper information.
typename
Read-only. The class name of the object.
HAPTER
1: JavaScript Object Reference
PaperInfo
121
PaperInfo
Paper information for use in printing documents.
PaperInfo properties
Finding paper information
// Displays the papers and paper sizes available for the 2nd printer in a text frame
var docRef = documents.add();
var itemRef = docRef.pathItems.rectangle(600, 300, 200, 100);
var textRef = docRef.textFrames.add();
textRef.top = 600;
textRef.left = 50;
HAPTER
1: JavaScript Object Reference
ParagraphAttributes
122
ParagraphAttributes
Specifies the properties and attributes of
a paragraph contained in a text frame.
The Burasagari type.
desiredGlyphScaling
number (double)
Desired glyph scaling, expressed as a
percentage of the default character width.
Range: 50.0 to 200.0. At 100.0, the width of
characters is not changed.
HAPTER
1: JavaScript Object Reference
ParagraphAttributes
123
hyphenationZone
number (double)
The distance (in points) from the right
edge of the paragraph that marks the part
of the line where hyphenation is not
allowed.
0 allows all hyphenation. Valid only
everyLineComposer
justification
Justification
Paragraph justification.
kinsoku
The Kinsoku Shori name.
kinsokuOrder
KinsokuOrderEnum
The preferred Kinsoku order.
kurikaeshiMojiShori
boolean
If
, KurikaeshiMojiShori is enabled.
leadingType
AutoLeadingType
Auto leading type.
leftIndent
number (double)
The left indent of margin in points.
maximumConsecutiveHyphens
number (long)
Maximum number of consecutive
hyphenated lines.
maximumGlyphScaling
number (double)
Maximum glyph scaling, expressed as a
percentage of the default character width.
Range: 50.0 to 200.0; at 100.0. The width of
characters is not changed.
Valid only for justified paragraphs.
HAPTER
1: JavaScript Object Reference
ParagraphAttributes
124
minimumGlyphScaling
number (double)
Minimum glyph scaling, expressed as a
percentage of the default character width.
Range: 50.0 to 200.0. At 100.0, the width of
characters is not changed.
Valid only for justified paragraphs.
minimumHyphenatedWordSize
number (long)
Minimum number of characters for a word
to be hyphenated.
Single word justification.
spaceAfter
number (double)
Spacing after paragraph in points.
spaceBefore
number (double)
Spacing before paragraph in points.
tabStops
TabStopInfo
HAPTER
1: JavaScript Object Reference
ParagraphAttributes
125
Changing justification in paragraphs
// Creates a new document with 1 text frame and 3 paragraphs
// then gives each paragraph a different justification
var docRef = documents.add();
var pathRef = docRef.pathItems.rectangle(600, 200, 200, 400);
var textRef = docRef.textFrames.areaText(pathRef);
textRef.paragraphs.add("Left justified paragraph.");
textRef.paragraphs.add("Center justified paragraph.");
textRef.paragraphs.add("Right justified paragraph.");
textRef.textRange.characterAttributes.size = 28;
// change the justification of each paragraph
// using the paragraph attributes object
var paraAttr_0 = textRef.paragraphs[0].paragraphAttributes;
paraAttr_0.justification = Justification.RIGHT;
var paraAttr_1 = textRef.paragraphs[1].paragraphAttributes;
paraAttr_1.justification = Justification.CENTER;
var paraAttr_2 = textRef.paragraphs[2].paragraphAttributes;
paraAttr_2.justification = Justification.LEFT;
HAPTER
1: JavaScript Object Reference
Paragraphs
126
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.l�ength 0 ) {
doc = app.activeDocument;
paragraphCount = 0;
for ( i = 0; i doc.textFrames.length; i++ ) {
paragraphCount += doc.textFrames[i].paragraphs.length;
PropertyValue typeWhat it is
length
number
Read-only. The number of objects in the collection.
parent
objectRead-only. The parent of this object.
typename
string
Read-only. The class name of the referenced object.
ElementPlacement
TextRange
Adds a new paragraph with
specified text contents at the
specified location in the current
document. If location is not
specified, adds the new paragraph
to the containing text frame after
the current text selection or
insertion point.
addBefore
(contents)string
TextRange
Adds a new paragraph with
specified text contents before the
current text selection or insertion
index
(itemKey)number
TextRange
HAPTER
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
Property
Value type
What it is
characterAttributes
CharacterAttributes
Read-only. The character properties for the text
range.
name
string
The paragraph styles name.
paragraphAttributes
ParagraphAttributes
Read-only. The paragraph properties for the text
range.
parent
object
Read-only. The objects container.
typename
string
Read-only. The class name of the object.
HAPTER
1: JavaScript Object Reference
ParagraphStyles
128
ParagraphStyles
A collection of
ParagraphStyle
objects.
ParagraphStyles properties
Creates a named paragraph style.
HAPTER
1: JavaScript Object Reference
ParagraphStyles
129
Creating and applying a paragraph style
// Creates a new document with 1 text frame and 3 paragraphs
// gives each paragraph a different justification, then creates
// a paragraph style and applies it to all paragraphs
var docRef = documents.add();
var pathRef = docRef.pathItems.rectangle(600, 200, 200, 400);
var textRef = docRef.textFrames.areaText(pathRef);
textRef.paragraphs.add("Left justified paragraph.");
textRef.paragraphs.add("Center justified paragraph.");
textRef.paragraphs.add("Right justified paragraph.");
textRef.textRange.characterAttributes.size = 28;
// change the justification of each paragraph
// using the paragraph attributes object
var paraAttr_0 = textRef.paragraphs[0].paragraphAttributes;
paraAttr_0.justification = Justification.RIGHT;
var paraAttr_1 = textRef.paragraphs[1].paragraphAttributes;
paraAttr_1.justification = Justification.CENTER;
var paraAttr_2 = textRef.paragraphs[2].paragraphAttributes;
paraAttr_2.justification = Justification.LEFT;
// create a new paragraph style
var paraStyle = docRef.paragraphStyles.add("LeftIndent");
// add some paragraph attributes
var paraAttr = paraStyle.paragraphAttributes;
paraAttr.justification = Justification.LEFT;
paraAttr.firstLineIndent = 10;
// apply the style to each item in the document
var iCount = textRef.paragraphs.length;
for(var i=0; iiCount; i++) {
paraStyle.applyTo(textRef.paragraphs[i], true);
redraw();
HAPTER
1: JavaScript Object Reference
PathItem
130
PathItem
Specifies a path item, which contains
PathPoint
Is this object used to create a knockout, and if so,
what kind of knockout.
blendingMode
BlendModes
The blend mode used when
compositing an object.
clipping
boolean
If
, this path should be used as a clipping path.
closed
boolean
If
, this path is closed.
controlBounds
of 4 numbersRead-only. The bounds of the object including stroke
width and controls.
editable
boolean
Read-only. If
true
, this item is editable.
evenodd
boolean
If
, the even-odd rule should be used to
The fill color of the path.
filled
boolean
If
, the path be filled.
fillOverprint
boolean
If
, the art beneath a filled object should be
overprinted.
Read-only. The layer to which this item belongs.
left
number (double)
The position of the left side of the item (in points,
measured from the left side of the page).
HAPTER
1: JavaScript Object Reference
PathItem
131
length
number (double)
The length of this path in points.
locked
boolean
If
, this item is locked.
name
string
The name of this item.
note
string
The note text assigned to the path.
opacity
number (double)
The opacity of the object. Range: 0.0 to 100.0
parent
GroupItem
Read-only. The parent of this object.
pathPoints
PathPoints
Read-only. The path points contained in this path
item.
pixelAligned
boolean
True if this item is aligned to the pixel grid.
polarity
PolarityValues
The polarity of the path.
position
of 2 numbersThe position (in points) of the top left corner of the
pathItem
object in the format [x, y]. Does not
include stroke weight.
resolution
number (double)
The resolution of the path in dots per inch (dpi).
selected
boolean
If
, this item is selected.
selectedPathPoints
PathPoints
Read-only. All of the selected path points in the path.
sliced
boolean
If
, the item sliced. Default:
strokeCap
StrokeCap
The type of line capping.
strokeColor
The stroke color for the path.
stroked
boolean
If
, the path should be stroked.
strokeDashes
object
Dash lengths. Set to an empty object,
, for a solid
line.
Type of joints for the path.
strokeMiterLimit
number (double)
HAPTER
1: JavaScript Object Reference
PathItem
132
Read-only. The tags contained in this item.
number (double)
The position of the top of the item (in points,
measured from the bottom of the page).
typename
string
Read-only. The class name of the referenced object.
string
The value of the Adobe URL tag assigned to this
item.
visibilityVariable
Variable
The visibility variable bound to the item.
visibleBounds
of 4 numbersRead-only. The visible bounds of the item including
stroke width.
width
number (double)
The width of the item.
wrapInside
boolean
If
, the text frame object should be wrapped
inside this object.
PathItem
Creates a duplicate of the
selected object.
move
(relativeObject,
insertionLocation)
object
ElementPlacement
Moves the object.
remove
NothingScales the art item where
scaleX
is the horizontal
scaling factor and
scaleY
the vertical scaling factor.
100.0 = 100%.
HAPTER
1: JavaScript Object Reference
PathItem
133
Setting colors in a path
NothingRotates the art item relative
to the current rotation. The
object is rotated
counter-clockwise if the
angle
value is positive,
clockwise if the value is
negative.
NothingTransforms the art item by
applying a transformation
matrix.
translate
([deltaX]
[,deltaY]
[,transformObjects]
[,transformFillPatterns]
[,transformFillGradients]
[,transformStrokePatterns])
number (double)
number (double)
boolean
boolean
boolean
boolean
NothingRepositions the art item
relative to the current
position, where
deltaX
NothingArranges the art items
position in the stacking
order of the group or layer
(parent) of this object.
HAPTER
1: JavaScript Object Reference
PathItem
134
Creating a path from straight lines
This script illustrates the use of the
HAPTER
1: JavaScript Object Reference
PathItems
135
PathItems
A collection of
PathItem
Creates a new object.
ellipse
([top]
[,width][,height]
[,reversed]
[,inscribed])
number (double)
number (double)
number (double)
number (double)
PathItem
Creates a new pathItem in the shape of
Creates a new pathItem in the shape of
an polygon using the supplied
Creates a new pathItem in the shape of
an polygon using the supplied
parameters.
removeAll
HAPTER
1: JavaScript Object Reference
PathItems
136
Creating shapes
// Creates 5 shapes in layer 1 of document 1
// and applies a random graphic style to each
var doc = app.documents.add();
var artLayer = doc.layers[0];
app.defaultStroked = true;
app.defaultFilled = true;
var rect = artLayer.pathItems.rectangle( 762.5, 87.5, 425.0, 75.0 );
var rndRect = artLayer.pathItems.roundedRectangle(
637.5, 87.5, 425.0, 75.0, 20.0, 10.0 );
// Create ellipse, 'reversed' is false, 'inscribed' is true
var ellipse = artLayer.pathItems.ellipse(
512.5, 87.5, 425.0, 75.0, false, true );
// Create octagon, and 8-sided polygon
var octagon = artLayer.pathItems.polygon( 300.0, 325.0, 75.0, 8 );
// Create a 4 pointed star
var star = artLayer.pathItems.star( 300.0, 125.0, 100.0, 20.0, 4 );
for ( i = 0; i artLayer.pathItems.length; i++ ) {
styleIndex = Math.round(
Math.random() * ( doc.graphicStyles.length - 1 ) );
doc.graphicStyles[styleIndex].applyTo( artLayer.pathItems[i] );
roundedRectangle
(top,
[,horizontalRadius]
[,verticalRadius]
[,reversed])
number (double)
number (double)
number (double)
number (double)
number (double)
number (double)
PathItem
Creates a new pathItem in the shape of a
rectangle with rounded corners using
Creates a new path item in the shape of a
HAPTER
1: JavaScript Object Reference
PathPoint
137
PathPoint
A point on a specific path. Each path point is made up of an anchor point (
anchor
) and a pair of handles
leftDirection
rightDirection
PathPoint properties
Read-only. The path item that contains this path point.
pointType
PointType
The type of path point, either a curve or a corner. Any
Are points of this path point selected, and if so, which
ones.
typename
string
Read-only. The class name of the referenced object.
HAPTER
1: JavaScript Object Reference
PathPoints
138
PathPoints
A collection of
PathPoint
objects in a specific path. The elemen
ts are not named; you must access them
by index.
PathPoints properties
Creates a new
PathPoint
object.
index
(itemKey)number
PathPoint
HAPTER
1: JavaScript Object Reference
Pattern
139
Pattern
An Illustrator pattern definition contained in a docu
object, which defines the patterns appearance.
Pattern properties
Read-only. The document that contains this pattern.
typename
string
Read-only. The class name
of the referenced object.
HAPTER
1: JavaScript Object Reference
PatternColor
140
PatternColor
A pattern color specification. You can create a new pa
ttern color by modifying an existing pattern in the
A reference to the pattern object that defines the pattern to
use in this color definition.
reflect
boolean
If
, the prototype should be reflected before filling.
Default:
false
reflectAngle
number (double)
The axis around which to reflect, in points. Default: 0.0
rotation
number (double)
The angle in radians to rotate the prototype pattern before
filling. Default: 0.0
scaleFactor
array
2numbers
The fraction to which to scale the prototype pattern before
filling, represented as a point containing horizontal and
vertical scaling percentages.
shearAngle
number (double)
The angle in radians by which to slant the shear. Default: 0.0
shearAxis
number (double)
The axis to shear with respect to, in points. Default: 0.0
shiftAngle
number (double)
The angle in radians to which to translate the unscaled
prototype pattern before filling. Default: 0.0
shiftDistance
number (double)
The distance in points to which to translate the unscaled
prototype pattern before filling. Default: 0.0
typename
string
Read-only. The class name of the referenced object.
HAPTER
1: JavaScript Object Reference
PatternColor
141
Modifying and applying pattern colors
// Rotates the color of each pattern in the current document,
// then applies the last pattern to the first path item
if ( app.documents.l�ength 0 && app.activeDocument.pathItems�.length 0 ) {
doc = app.activeDocument;
swatchIndex = 0;
for ( i = 0; i doc.swatches.length; i++ ) {
HAPTER
1: JavaScript Object Reference
Patterns
142
Patterns
A collection of
Pattern
objects in a document.
Patterns properties
Creates a new object.
HAPTER
1: JavaScript Object Reference
PDFFileOptions
143
PDFFileOptions
Options for opening a PDF file, used with the
Which box should be used when
placing a multipage document.
Default:
PDFBoxType.PDFMediaBox
typename
string
Read-only. The class name of the object.
HAPTER
1: JavaScript Object Reference
PDFSaveOptions
144
PDFSaveOptions
Options for saving a document as an Adobe PDF file, used with the
saveAs
Optional. The type of color
bitmap compression used.
None
colorConversionID
ColorConversion
Optional. The PDF color
conversion policy. Default:
ColorConversion.None
colorDestinationID
ColorDestination
Optional. The conversion
HAPTER
1: JavaScript Object Reference
PDFSaveOptions
145
colorDownsamplingMethod
Optional. How color bitmap
images should be
resampled. Default:
Optional. The color profile to
include. Default:
ColorProfile.None
colorTileSize
number (long)
Optional. Tile size when
compressing with
JPEG2000. Default: 256
compatibility
PDFCompatibility
Optional. The version of the
Acrobat file format to create.
PDFCompatibility.
Acrobat5
compressArt
boolean
Optional. If
, the line art
and text should be
compressed.
documentPassword
string
Optional. A password string
to open the document.
enableAccess
boolean
Optional. If
true
accessing 128-bit.
enableCopy
boolean
Optional. If
true
copying of text 128-bit.
enableCopyAccess
boolean
Optional. If
true
copying and accessing
40-bit. Default:
enablePlainText
boolean
Optional. If
true
Optional. The printing
flattener options.
HAPTER
1: JavaScript Object Reference
PDFSaveOptions
146
Optional. Quality of
grayscale bitmap
compression. Default:
grayscaleDownsampling
number (double)
Optional. Downsampling
resolution in dots per inch
(dpi). If 0, no downsampling
is performed. Default: 150.0
Optional. How grayscale
resampled Default:
Optional. Type of
monochrome bitmap
compression used. Default:
MonochromeCompression.
None
monochromeDownsampling
number (double)
Optional. Downsampling
resolution in dots per inch
(dpi). If 0, no downsampling
is performed. Default: 300
HAPTER
1: JavaScript Object Reference
PDFSaveOptions
147
Optional. How monochrome
resampled. Default:
Optional. The page marks
style. Default:
PageMarksType.Roman
pDFAllowPrinting
PDFPrintAllowedEnum
Optional. PDF security
printing permission. Default:
PDFPrintAllowedEnum.
PRINT128HIGHRESOLUTION
pDFChangesAllowed
PDFChangesAllowedEnum
Optional. Security changes
allowed. Default:
PDFChangeAllowedEnum.
CHANGE128ANYCHANGES
Optional. The PDF standard
complies. Default:
PDFXStandard.PDFXNONE
pDFXStandardDescription
string
Optional. A description of
the PDF standard from the
HAPTER
1: JavaScript Object Reference
PDFSaveOptions
148
permissionPassword
string
Optional. A password string
to restrict editing security
Optional. The trim mark
weight. Default:
PDFTrimMarkWeight.
TRIMMARKWEIGHT0125
typename
string
Optional. Read-only. The
class name of the referenced
object.
viewAfterSaving
boolean
Optional. View PDF after
saving. Default:
false
Property
Value type
What it is
HAPTER
1: JavaScript Object Reference
PDFSaveOptions
149
Saving to PDF format
// Saves the current document as PDF to dest with specified options
// dest contains the full path and file name to save to
HAPTER
1: JavaScript Object Reference
PhotoshopFileOptions
150
PhotoshopFileOptions
Options for opening a Photoshop file, used with the
HAPTER
1: JavaScript Object Reference
PlacedItem
151
PlacedItem
An artwork item placed in a document as a linked file. For example, an artwork object created using the
F�ile Place command in Illustrator or using the
PlacedItems
Ž on page155
PlacedItem properties
Property
Value typeWhat it is
artworkKnockout
KnockoutState
Is this object used to create a knockout, and if so, what
kind of knockout.
blendingMode
BlendModes
The blend mode used when compositing an object.
boundingBox
array
of 4 numbersRead-only. The dimensions of the placed art item
regardless of transformations.
contentVariable
Variable
The content variable bound to the item.
controlBounds
array
of 4 numbersRead-only. The bounds of the object including stroke
width and controls.
editable
boolean
Read-only. If
true
, this item is editable.
file
File
The file containing the artwork.
Read-only. The layer to which this item belongs.
left
number (double)
The position of the left side of the item (in points,
measured from the left side of the page).
locked
boolean
If
, this item is locked.
matrix
Matrix
The transformation matrix
of the placed artwork.
name
string
The name of this item.
note
string
The note assigned to this item.
opacity
number (double)
The opacity of the object. Range: 0.0 to 100.0
parent
Layer
GroupItem
Read-only. The parent of this object.
position
array
of 2 numbersThe 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
, this item is selected.
HAPTER
1: JavaScript Object Reference
PlacedItem
152
Read-only. The tags contained in this item.
number (double)
The position of the top of the item (in points, measured
from the bottom of the page).
typename
string
Read-only. The class name of the referenced object.
string
The value of the Adobe URL tag assigned to this item.
visibilityVariable
Variable
The visibility variable bound to the item.
visibleBounds
array
of 4 numbersRead-only. The visible bounds of the item including
stroke width.
width
number (double)
The width of the item.
wrapInside
boolean
If
, the text frame object should be wrapped inside
this object.
PlacedItem
Creates a duplicate of the
selected object.
embed
NothingEmbeds this art in the
document. Converts the art
to art item objects as
needed and deletes this
object.
move
(relativeObject,
insertionLocation)
object
ElementPlacement
PlacedItem
Moves the object.
relink
(linkFile)
File object
NothingRelinks the art object with
remove
HAPTER
1: JavaScript Object Reference
PlacedItem
153
resize
(scaleX,
[,changePositions]
[,changeFillPatterns]
[,changeFillGradients]
[,changeStrokePattern]
[,changeLineWidths]
[,scaleAbout])
number (double)
number (double)
boolean
boolean
boolean
boolean
number (double)
Transformation
NothingScales the art item where
is the horizontal
scaling factor and
scaleY
is the vertical scaling factor.
100.0 = 100%.
rotate
(angle
[,changePositions]
[,changeFillPatterns]
[,changeFillGradients]
[,changeStrokePattern]
[,rotateAbout])
number (double)
boolean
boolean
boolean
boolean
Transformation
NothingRotates the art item relative
to the current rotation. The
object is rotated
counter-clockwise if the
value is positive,
clockwise if the value is
negative.
trace
PluginItem
Converts the raster art for
this object to vector art,
using default options.
Reorders the placed art
into the source art of a
plug-in group, and
converts it into a group of
filled and/or stroked paths
that resemble the original
image.
NothingTransforms the art item by
applying a transformation
translate
([deltaX]
[,deltaY]
[,transformObjects]
[,transformFillPatterns]
[,transformFillGradients]
[,transformStrokePatterns])
number (double)
number (double)
boolean
boolean
boolean
boolean
NothingRepositions the art item
relative to the current
position, where
is
NothingArranges the art items
position in the stacking
order of the group or layer
(parent) of this object.
HAPTER
1: JavaScript Object Reference
PlacedItem
154
Changing the selection state of placed items
// Toggles the selection state of all placed items.
if ( app.documents.l�ength 0 ) {
for ( i = 0; i app.activeDocument.placedItems.length; i++ ) {
placedArt = app.activeDocument.placedItems[i];
placedArt.selected = !(placedArt.selected);
HAPTER
1: JavaScript Object Reference
155
PlacedItems
A collection of
PlacedItem
objects in the document.
PlacedItems properties
Creates a new object. Use to place new art in a
document. Use the
property of the resulting
placedItem
object to link the file containing the
artwork. See
Ž on page151
HAPTER
1: JavaScript Object Reference
PluginItem
156
An art item created by an Illustrator plug-in. Scripts can create a plug-in item using
PlacedItem.trace
RasterItem.trace
, and can copy existing plug-in items using the
duplicate
Is this object used to create a knockout, and if so, what
kind of knockout.
blendingMode
BlendModes
The blend mode used when compositing an object.
controlBounds
array
of 4 numbersRead-only. The bounds of the object including stroke
width and controls.
editable
boolean
Read-only. If
true
, this item is editable.
Read-only. The layer to which this item belongs.
left
number (double)
The position of the left side of the item (in points,
measured from the left side of the page).
locked
boolean
If
, this item is locked.
name
string
The name of this item.
note
string
The note assigned to this item.
opacity
number (double)
The opacity of the object. Range: 0.0 to 100.0
parent
Layer
GroupItem
Read-only. The parent of this object.
position
array
of 2 numbersThe position (in points) of the top left corner of the
plugInItem
object in the format [x, y]. Does not include
stroke weight.
selected
boolean
If
, this item is selected.
sliced
boolean
If
, the item sliced. Default:
HAPTER
1: JavaScript Object Reference
PluginItem
157
Read-only. The tags contained in this item.
number (double)
The position of the top of the item (in points, measured
from the bottom of the page).
tracing
TracingObject
When this plug-in group was created by tracing
isTracing
), the tracing object associated with
the options used to create it.
typename
string
Read-only. The class name
of the referenced object.
string
The value of the Adobe URL tag assigned to this item.
visibilityVariable
Variable
The visibility variable bound to the item.
visibleBounds
array
of 4 numbersRead-only. The visible bounds of the item including
stroke width.
width
number (double)
The width of the item.
wrapInside
boolean
If
, the text frame object should be wrapped inside
this object.
PluginItem
Creates a duplicate of
the selected object.
move
(relativeObject,
insertionLocation)
object
ElementPlacement
PluginItem
Moves the object.
remove
HAPTER
1: JavaScript Object Reference
PluginItem
158
Copying a plug-in item
// Creates new plug-in art by copying an existing plug-in art item
if ( app.documents.l�ength 0 && app.activeDocument.pluginItems.length � 0 ) {
doc = app.activeDocument;
pluginArt = doc.pluginItems[0];
pluginArt.duplicate( pluginArt.parent,
ElementPlacement.PLACEATBEGINNING );
resize
(scaleX,
[,changePositions]
[,changeFillPatterns]
[,changeFillGradients]
[,changeStrokePattern]
[,changeLineWidths]
[,scaleAbout])
number (double)
number (double)
boolean
boolean
boolean
boolean
number (double)
Transformation
NothingScales the art item
scaleX
horizontal scaling factor
scaleY
vertical scaling factor.
100.0 = 100%.
rotate
(angle
[,changePositions]
[,changeFillPatterns]
[,changeFillGradients]
[,changeStrokePattern]
[,rotateAbout])
number (double)
boolean
boolean
boolean
boolean
Transformation
NothingRotates the art item
relative to the current
rotation. The object is
rotated
counter-clockwise if the
angle
value is positive,
clockwise if the value is
negative.
transform
(transformationMatrix
[,changePositions]
[,changeFillPatterns]
[,changeFillGradients]
[,changeStrokePattern]
[,changeLineWidths]
[,transformAbout])
boolean
boolean
boolean
boolean
number (double)
Transformation
NothingTransforms the art item
by applying a
transformation matrix.
translate
([deltaX]
[,deltaY]
[,transformObjects]
[,transformFillPatterns]
[,transformFillGradients]
[,transformStrokePatterns])
number (double)
number (double)
boolean
boolean
boolean
boolean
NothingRepositions the art item
relative to the current
position, where
deltaX
NothingArranges the art items
position in the stacking
order of the group or
layer (parent) of this
object.
HAPTER
1: JavaScript Object Reference
PluginItems
159
A collection of
PluginItem
objects in a document. See
PluginItems properties
HAPTER
1: JavaScript Object Reference
PPDFile
160
PPDFile
Associates file information with a PostScript Printer Description (PPD) file.
PPDFile properties
PropertyValue type
What it is
name
The PPD model name.
PPDInfo
PPDFileInfo
The PPD file information.
typename
Read-only. The class name of the object.
HAPTER
1: JavaScript Object Reference
PPDFileInfo
161
PPDFileInfo
Information about a PostScript Printer Description (PPD) file.
PPDFileInfo properties
Displaying PPD file properties
// Displays postscript level and path for each PPD file found in a new text frame
var sPPD = "";
var docRef = documents.add();
var x = 30;
var y = (docRef.height - 30);
var iLength = PPDFileList.length;
if (iLe�ngth 20)
iLength = 20;
for(var i=0; iiLength; i++) {
var ppdRef = PPDFileList[i];
sPPD = ppdRef.name;
sPPD += "\r\tPS Level ";
var ppdInfoRef = ppdRef.PPDInfo;
sPPD += ppdInfoRef.languageLevel;
sPPD += "\r\tPath: ";
sPPD += ppdInfoRef.PPDFilePath;
var textRef = docRef.textFrames.add();
textRef.textRange.characterAttributes.size = 8;
textRef.contents = sPPD;
textRef.top = (y);
textRef.left = x;
redraw();
if( (y-=(textRef.height)) = 30 ) {
y = (docRef.height - 30);
Property
Value type
What it is
languageLevel
The PostScript language level.
PPDFilePath
Path specification for the PPD file.
screenList
Screen
List of color separation screens.
screenSpotFunctionList
ScreenSpotFunction
List of color separation screen spot functions.
HAPTER
1: JavaScript Object Reference
PPDFileInfo
162
PPDFileInfo and related screen information
// Displays in a new text frame, the postscript level, file paths, screens, and
// screen spot information for first 10 PPD files found
var sPPD = "";
var docRef = documents.add();
var x = 30;
var y = (docRef.height - 30);
var iLength = PPDFileList.length;
if (iLe�ngth 10)
iLength = 10;
for(var i=0; iiLength; i++) {
var ppdRef = PPDFileList[i];
sPPD = ppdRef.name;
sPPD += "\r\tPS Level ";
var ppdInfoRef = ppdRef.PPDInfo;
sPPD += ppdInfoRef.languageLevel;
sPPD += "\r\tPath: ";
sPPD += ppdInfoRef.PPDFilePath;
sPPD += "\r\tScreens:\r";
var iScreens = ppdInfoRef.screenList.length;
for(var c=0; ciScreens; 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; niScreenSpots; n++) {
var screenSpotRef = ppdInfoRef.screenSpotFunctionList[n];
sPPD += "\t\t";
sPPD += screenSpotRef.name;
sPPD += ", spotFunction: ";
sPPD += screenSpotRef.spotFunction;
sPPD += "\r";
var textRef = docRef.textFrames.add();
textRef.textRange.characterAttributes.size = 8;
textRef.contents = sPPD;
textRef.top = (y);
textRef.left = x;
redraw();
y-=(textRef.height);
HAPTER
1: JavaScript Object Reference
163
Preferences
Specifies the preferred options for AutoCAD, FreeHand, PDF, and Photoshop files.
Preferences properties
Read-only. Options to use when opening or
placing an AutoCAD file.
FreeHandFileOptions
OpenOptionsFreeHand
Read-only. Options to use when opening or
placing a FreeHand file.
parent
object
Read-only. The parent of this object.
PDFFileOptions
PDFFileOptions
Read-only. Options to use when opening or
placing a PDF file.
PhotoshopFileOptions
PhotoshopFileOptions
Read-only. Options to use when opening or
placing a Photoshop file.
typename
string
Read-only. The class name of the referenced
object.
HAPTER
1: JavaScript Object Reference
164
HAPTER
1: JavaScript Object Reference
165
PrintColorManagementOptions
Information used for color management of the document.
PrintColorManagementOptions properties
Managing colors for printing
// Creates a new document, adds symbols, then creates a
// PrintColorManagementOptions object and assigns it
// to a PrintOptions object, then prints with each color intent
// Add some symbol items to a new document
var docRef = documents.add();
var y = docRef.height - 30;
for(var i=0; i(docRef.symbols.length); i++) {
symbolRef = docRef.symbols[i];
symbolItemRef1 = docRef.symbolItems.add(symbolRef);
symbolItemRef1.top = y;
symbolItemRef1.left = 100;
y -= (symbolItemRef1.height + 10);
redraw();
var colorOptions = new PrintColorManagementOptions();
var options = new PrintOptions();
options.colorManagementOptions = colorOptions;
colorOptions.name = "ColorMatch RGB";
// Print the current document once for each color intent.
The color management profile mode.
PrintColorProfile.SOURCEPROFILE
intent
PrintColorIntent
The color management intent type.
HAPTER
1: JavaScript Object Reference
PrintColorSeparationOptions
166
PrintColorSeparationOptions
Information about the color separations to be used in printing the document.
PrintColorSeparationOptions properties
Managing color separations for printing
// Creates a new document with symbol items
// and prints document with each separation option
// Add some symbol items to a new document
var docRef = documents.add();
var y = docRef.height - 30;
for(var i=0; i(docRef.symbols.length); i++) {
symbolRef = docRef.symbols[i];
symbolItemRef1 = docRef.symbolItems.add(symbolRef);
symbolItemRef1.top = y;
symbolItemRef1.left = 100;
y -= (symbolItemRef1.height + 10);
// Print with various separation options
var sepOptions = new PrintColorSeparationOptions();
var options = new PrintOptions();
options.colorSeparationOptions = sepOptions;
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);
Property
Value type
What it is
colorSeparationMode
PrintColorSeparationMode
The color separation type. Default:
PrintColorSeparationMode.COMPOSITE
convertSpotColors
boolean
If
true
, all spot colors should be converted
to process colors. Default:
inkList
array
The list of inks for color separation.
overPrintBlack
boolean
If
, overprint in black. Default:
false
typename
string
Read-only. The class name of the object.
HAPTER
1: JavaScript Object Reference
167
PrintCoordinateOptions
The artwork orientation.
Default:
PrintOrientation.PORTRAIT
position
PrintPosition
The artwork position on media.
Default:
PrintPosition.TRANSLATECENTER
tiling
PrintTiling
The page tiling mode.
Default:
PrintTiling.TILESINGLEFULLPAGE
typename
string
Read-only. The class name of the object.
verticalScale
number (double)
The vertical scaling factor expressed as a percentage
(100=100%) Range: 1.0 to 10000.0. Default: 100.0
HAPTER
1: JavaScript Object Reference
168
docRef.print(options);
coordinateOptions.emulsion = false;
coordinateOptions.fitToPage = false;
coordinateOptions.orientation = PrintOrientation.PORTRAIT;
coordinateOptions.horizontalScale = 50;
coordinateOptions.verticalScale = 50;
docRef.print(options);
HAPTER
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
PropertyValue type
What it is
name
string
The printer name.
printerInfo
PrinterInfo
The printer information.
typename
string
Read-only. The class name of the object.
HAPTER
1: JavaScript Object Reference
PrinterInfo
170
PrinterInfo
Configuration information about a printer.
PrinterInfo properties
Property
Value type
What it is
binaryPrintingSupport
boolean
If
true
, the printer supports
binary printing.
colorSupport
PrinterColorMode
The printer color capability.
customPaperSupport
boolean
If
true
, the printer supports
custom paper size.
customPaperTransverseSupport
boolean
If
true
, the printer supports
custom paper transverse.
deviceResolution
number (double)
The printer default resolution.
inRIPSeparationSupport
boolean
If
true
, the printer supports
InRIP color separation.
maxDeviceResolution
number (double)
The printer maximum device
resolution.
maxPaperHeight
number (double)
Custom papers maximum
height.
maxPaperHeightOffset
number (double)
Custom papers maximum
The list of supported paper
sizes.
postScriptLevel
PrinterPostScriptLevelEnum
The PostScript Language level.
HAPTER
1: JavaScript Object Reference
PrinterInfo
171
Finding available printers
// Displays a list of available printers in a new text frame
var docRef = documents.add();
var textRef = docRef.textFrames.add();
var iCount = printerList.length;
textRef.contents += "Printers...\r";
for( var i=0; iiCount; i++ ) {
textRef.contents += printerList[i].name;
textRef.contents += "\r\t";
textRef.top = 600;
textRef.left = 200;
redraw();
printerType
PrinterTypeEnum
The printer type.
typename
string
Read-only. The class name of
the object.
PropertyValue typeWhat it is
HAPTER
1: JavaScript Object Reference
PrintFlattenerOptions
172
PrintFlattenerOptions
Contains flattening options for use when Illustrator outputs artwork that contains transparency into a
non-native format.
PrintFlattenerOptions properties
Property
Value typeWhat it is
clipComplexRegions
boolean
If
true
, complex regions should be clipped.
convertStrokesToOutlines
boolean
If
true
, convert all strokes to outlines.
convertTextToOutlines
boolean
If
true
, all text is converted to vector paths;
preserves the visual appearance of type.
flatteningBalance
number (long)
The flattening balance. Range: 0.0 to 100.0.
Default:100.0
gradientResolution
number (double)
The gradient resolution in dots per inch (dpi).
Range: 1.0 to 9600.0. Default: 300.0
overprint
PDFOverprint
HAPTER
1: JavaScript Object Reference
PrintFlattenerOptions
173
Setting print flattening
// Creates a new document, adds symbols to the document
HAPTER
1: JavaScript Object Reference
174
PrintFontOptions
Contains information about font downloading and su
bstitution for the fonts used for printing the
document.
PrintFontOptions properties
Printing with font options
// Creates a new document, adds text then prints with specified font options.
var docRef = documents.add();
var pathRef = docRef.pathItems.rectangle(500,300,400,400);
var textRef = docRef.textFrames.areaText(pathRef);
textRef.contents = "Text example";
//Create PrintFontOptions object and assign to a PrintOptions object
var fontOpts = new PrintFontOptions();
var printOpts = new PrintOptions();
printOpts.fontOptions = fontOpts;
The font download mode. Default:
The font substitution policy. Default:
FontSubstitutionPolicy.SUBSTITUTEOBLIQUE
typename
string
Read-only. The class name of the object.
HAPTER
1: JavaScript Object Reference
PrintJobOptions
175
PrintJobOptions
Contains information about how the job is to be printed.
PrintJobOptions properties
Property
Value type
What it is
artboardRange
The artboard range to be printed if
printAllArtboards
is false. Default: 1-
bitmapResolution
number (double)
The bitmap resolution. Minimum: 0.0.
Default:0.0
collate
boolean
If
true
, collate print pages. Default:
false
copies
number (long)
The number of copies to print. Minimum: 1.
designation
PrintArtworkDesignation
The layers/objects to be printed.
PrintArtworkDesignation.
VISIBLEPRINTABLELAYERS
file
The file to which to print.
name
The print job name.
printAllArtboards
boolean
Indicates whether to print all artboards.
printArea
PrintingBounds
The printing bounds.
PrintingBounds.ARTBOARDBOUNDS
printAsBitmap
boolean
If
true
, print as bitmap. Default:
reversePages
boolean
If
true
, print pages in reverse order.
typename
Read-only. The class name of the object.
HAPTER
1: JavaScript Object Reference
PrintJobOptions
176
Printing with job options
// Creates a new document with layers containing visible, printable,
// non visible and non printable items then prints with each designation
// to view effects of using different job options
var docRef = documents.add();
var textRef_0 = docRef.layers[0].textFrames.add();
textRef_0.contents = "Visible and Printable";
textRef_0.top = 600;
textRef_0.left = 200;
var layerRef_1 = docRef.layers.add();
var textRef_1 = layerRef_1.textFrames.add();
textRef_1.contents = "Visible and Non-Printable";
textRef_1.top = 500;
textRef_1.left = 250;
layerRef_1.printable = false;
var layerRef_2 = docRef.layers.add();
var textRef_2 = layerRef_2.textFrames.add();
textRef_2.contents = "Non-Visible";
textRef_2.top = 400;
textRef_2.left = 300;
layerRef_2.visible = false;
redraw();
// Print with various job options
var printJobOptions= new PrintJobOptions();
var options = new PrintOptions();
options.jobOptions = printJobOptions;
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);
HAPTER
1: JavaScript Object Reference
177
PrintOptions
Contains information about all printing options including flattening, color management, coordinates,
fonts, and paper.
PrintOptions properties
Property
Value type
What it is
colorManagementOptions
PrintColorManagementOptions
The printing color management
options.
colorSeparationOptions
PrintColorSeparationOptions
The printing color separation options.
coordinateOptions
PrintCoordinateOptions
The printing coordinate options.
flattenerOptions
PrintFlattenerOptions
The printing flattener options.
The printing font options.
jobOptions
PrintJobOptions
The printing job options.
pageMarksOptions
PrintPageMarksOptions
The printing page marks options.
paperOptions
PrintPaperOptions
The paper options.
postScriptOptions
PrintPostScriptOptions
The printing PostScript options.
PPDName
string
The PPD name.
printerName
string
The printer name.
HAPTER
1: JavaScript Object Reference
178
Setting print options
// Creates a new document, adds symbols, specifies a variety of print options,
// assigns each print option to a PrintOptions object,
// then prints with those options
// Create a new document and add some symbol items
var docRef = documents.add();
var y = docRef.height - 30;
for(var i=0; i(docRef.symbols.length); i++) {
symbolRef = docRef.symbols[i];
symbolItemRef1 = docRef.symbolItems.add(symbolRef);
symbolItemRef1.top = y;
symbolItemRef1.left = 100;
y -= (symbolItemRef1.height + 10);
redraw();
// Create multiple options and assign to PrintOptions
var options = new PrintOptions();
var colorOptions = new PrintColorManagementOptions();
colorOptions.name = "ColorMatch RGB";
colorOptions.intent = PrintColorIntent.SATURATIONINTENT;
options.colorManagementOptions = colorOptions;
var printJobOptions= new PrintJobOptions();
printJobOptions.designation = PrintArtworkDesignation.ALLLAYERS;
printJobOptions.reverse = true;
options.jobOptions = printJobOptions;
var coordinateOptions = new PrintCoordinateOptions();
coordinateOptions.fitToPage = true;
options.coordinateOptions = coordinateOptions;
var flatOpts = new PrintFlattenerOptions();
flatOpts .ClipComplexRegions = true;
flatOpts .GradientResoultion = 60;
flatOpts .RasterizatonResotion = 60;
options.flattenerOptions = flatOpts;
// Print with options
docRef.print(options);
HAPTER
1: JavaScript Object Reference
PrintPageMarksOptions
179
PrintPageMarksOptions
The options for printing page marks.
PrintPageMarksOptions properties
Setting page mark
// Creates a PrintPageMarksOptions object, assigns it
// to a PrintOptions object, then prints the current document.
var docRef = activeDocument;
var pageMarkOptions= new PrintPageMarksOptions();
var options = new PrintOptions();
options.pageMarksOptions = pageMarkOptions;
pageMarkOptions.colorBars = true;
pageMarkOptions.pageInfoMarks = true;
pageMarkOptions.registrationMarks = true;
pageMarkOptions.trimMarks = true;
docRef.print(options);
Property
Value typeWhat it is
The page marks style. Default:
PageMarksType.Roman
registrationMarks
boolean
If
, registration marks should be printed.
false
trimMarks
boolean
If
, trim marks should be printed. Default:
false
trimMarksWeight
number (double)
Stroke weight of trim marks. Minimum: 0.0.
0.125
typename
string
Read-only. The class name of the object.
HAPTER
1: JavaScript Object Reference
180
PrintPaperOptions
Information about the paper to be used in the print job.
PrintPaperOptions properties
Setting print paper options
// Creates a new document, adds a path item, applies a graphic style
// then prints with specified paper options
var docRef = documents.add();
var pathRef = docRef.pathItems.rectangle(600, 200, 200, 200);
docRef.graphicStyles[1].applyTo(pathRef);
var paperOpts = new PrintPaperOptions;
var printOpts = new PrintOptions;
printOpts.paperOptions = paperOpts;
var printerCount = printerList.length;
if (printerCount � 0){
// Print with the 1st paper from the 1st printer
for (var i = 0; i printerList.length; i++)
if (printerList[i].printerInfo.paperSizes.length � 0)
var printerRef = printerList[i];
var paperRef = printerRef.printerInfo.paperSizes[0];
if (printerRef.printerInfo.paperSizes.le�ngth 0){
paperOpts.name = paperRef.name;
printOpts.printerName = printerRef.name;
docRef.print(printOpts);
PropertyValue typeWhat it is
height
number (double)
The custom height (in points) for using the custom paper.
Default:0.0
name
string
The papers name.
HAPTER
1: JavaScript Object Reference
181
PrintPostScriptOptions
Options for printing to a PostScript printer.
PrintPostScriptOptions properties
Setting PostScript
printing options
// Prints current document with various postscript levels
// Create new postscript options object, assign to print options
var psOpts = new PrintPostScriptOptions();
var printOpts = new PrintOptions();
printOpts.postScriptOptions = psOpts;
// Assign PS level, print
psOpts.postScriptLevel = PrinterPostScriptLevelEnum.PSLEVEL2;
activeDocument.print(printOpts);
psOpts.postScriptLevel = PrinterPostScriptLevelEnum.PSLEVEL3;
activeDocument.print(printOpts);
Property
Value type
What it is
binaryPrinting
boolean
If
true
, printing should be in binary
mode. Default:
false
compatibleShading
boolean
If
true
, use PostScript
Level1-compatible gradient and
gradient mesh printing.
forceContinuousTone
boolean
If
true
, force continuous tone.
imageCompression
PostScriptImageCompressionType
The image compression type. Default:
ostScriptImageCompressionType.
IMAGECOMPRESSIONNONE
negativePrinting
boolean
If
true
, print in negative mode.
postScriptLevel
PrinterPostScriptLevelEnum
The PostScript language level.
PrinterPostScriptLevelEnum.LEVEL2
shadingResolution
number (double)
The shading resolution. Range: 1.0 to
9600.0 Default: 300.0
typename
Read-only. The class name of the
object.
HAPTER
1: JavaScript Object Reference
RasterEffectOptions
182
RasterEffectOptions
Specifies raster effects settings for the document. All properties are optional.
RasterEffectOptions properties
Property
Value type
What it is
antiAliasing
boolean
If
, the image should be antialiased.
clippingMask
boolean
If
, a clipping mask is created for the image.
colorModel
RasterizationColorModel
The color model for the rasterization. Default:
RasterizationColorModel.DEFAULTCOLORMODEL
convertSpotColors
boolean
If
, all spot colors are converted to process
colors for the image. Default:
padding
number (double)
The amount of white space (in points) to be added
around the object during rasterization. Default: .0
resolution
number (double)
The rasterization resolution
in dots per inch (dpi).
Range: 72.0 to 2400.0. Default: 300.0
transparency
boolean
If
, the image should use transparency.
HAPTER
1: JavaScript Object Reference
183
RasterItem
A bitmap art item in a document. A sc
ript can create a raster item from an external file, or by copying an
existing raster item with the
duplicate
Is this object used to create a knockout, and if so, what
kind of knockout.
bitsPerChannel
number (long)
Read-only. The number of bits per channel.
blendingMode
BlendModes
The blend mode used when compositing an object.
boundingBox
array
4numbers
The dimensions of the placed art item regardless of
transformations.
channels
number (long)
Read-only. The number of channels.
colorants
array
Read-only. The colorants used in the raster art.
colorizedGrayscale
boolean
Read-only. If
, the raster art is a colorized grayscale
image.
contentVariable
Variable
The content variable bound to the item.
controlBounds
array
4numbers
Read-only. The bounds of the object including stroke
width and controls.
editable
boolean
Read-only. If
, this item is editable.
embedded
boolean
If
, the raster art item is embedded in the illustration.
file
File
Read-only. The file containing the artwork.
Read-only. The color space of the raster image.
isIsolated
boolean
If
, this object is isolated.
layer
Layer
Read-only. The layer to which this item belongs.
left
number (double)
The position of the left side of the item (in points,
measured from the left side of the page).
locked
boolean
If
, this item is locked.
matrix
Matrix
The transformation matrix of the placed artwork.
name
string
The name of this item.
HAPTER
1: JavaScript Object Reference
184
note
string
The note assigned to this item.
opacity
number (double)
The opacity of the object. Range: 0.0 to 100.0
overprint
boolean
If
, the raster art overprints.
parent
Layer
GroupItem
Read-only. The parent of this object.
position
array
2numbers
The position (in points) of the top left corner of the
rasterItem
object in the format [x, y]. Does not include
stroke weight.
selected
boolean
If
, this item is selected.
sliced
boolean
If
, the item sliced. Default:
status
RasterLinkState
Status of the linked image.
tags
Tags
Read-only. The tags contained in this item.
number (double)
The position of the top of the item (in points, measured
from the bottom of the page).
transparent
boolean
Read-only. If
, the raster art is transparent.
typename
string
Read-only. The class name of the referenced object.
string
The value of the Adobe URL tag assigned to this item.
visibilityVariable
Variable
The visibility variable bound to the item.
visibleBounds
array
4numbers
Read-only. The visible bounds of the item including stroke
width.
width
number (double)
The width of the item.
wrapInside
boolean
If
, the text frame object should be wrapped inside
this object.
HAPTER
1: JavaScript Object Reference
185
NothingColorizes the raster item
with a CMYK or RGB Color.
duplicate
([relativeObject]
[,insertionLocation])
object
ElementPlacement
RasterItem
Creates a duplicate of the
selected object.
move
(relativeObject,
insertionLocation)
object
ElementPlacement
RasterItem
Moves the object.
remove
NothingScales the art item where
is the horizontal
scaling factor and
scaleY
is the vertical scaling
factor. 100.0 = 100%.
rotate
(angle
[,changePositions]
[,changeFillPatterns]
[,changeFillGradients]
[,changeStrokePattern]
[,rotateAbout])
number (double)
boolean
boolean
boolean
boolean
Transformation
NothingRotates the art item
relative to the current
rotation. The object is
rotated counter-clockwise
value is
positive, clockwise if the
value is negative.
trace
PluginItem
Converts the raster art for
this object to vector art,
using default options.
Reorders the raster art into
the source art of a plug-in
group, and converts it into
a group of filled and/or
stroked paths that
resemble the original
image.
Creates and returns a
pluginItem
object that
references a
tracingObject
object.
HAPTER
1: JavaScript Object Reference
186
transform
(transformationMatrix
[,changePositions]
[,changeFillPatterns]
[,changeFillGradients]
[,changeStrokePattern]
[,changeLineWidths]
[,transformAbout])
Matrix
boolean
boolean
boolean
boolean
number (double)
Transformation
NothingTransforms the art item by
applying a transformation
translate
([deltaX]
[,deltaY]
[,transformObjects]
[,transformFillPatterns]
[,transformFillGradients]
[,transformStrokePatterns])
number (double)
number (double)
boolean
boolean
boolean
boolean
NothingRepositions the art item
relative to the current
position, where
NothingArranges the art items
position in the stacking
order of the group or layer
(parent) of this object.
HAPTER
1: JavaScript Object Reference
187
RasterItems
A collection of
RasterItem
objects.
RasterItems properties
HAPTER
1: JavaScript Object Reference
188
Finding and examining a raster item
// Examines the color space of the first raster item in the document and displays
// result in ESTK console
if ( app.documents.l�ength 0 && app.activeDocument.rasterItems.length � 0 ) {
var rasterArt = app.activeDocument.rasterItems[0];
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;
HAPTER
1: JavaScript Object Reference
RasterizeOptions
189
RasterizeOptions
Specifies options that may be supplied when rast
erizing artwork. All properties are optional.
RasterizeOptions properties
Property
Value type
What it is
The color model for the rasterization. Default:
RasterizationColorModel.DEFAULTCOLOR
MODEL
convertSpotColors
boolean
If
true
, spot colors should be converted to
process colors for the image. Default:
convertTextToOutlines
boolean
If
, all text is converted to outlines before
rasterization. Default:
includeLayers
boolean
If
true
, the resulting image incorporates
layer attributes (like opacity and blend
mode). Default:
false
padding
number (double)
The amount of white space (in points) to be
added around the object during
rasterization. Default: .0
resolution
number (double)
The rasterization resolution in dots per inch
(dpi). Range: 72.0 to 2400.0. Default: 300.0
transparency
boolean
If
true
, the image should use transparency.
HAPTER
1: JavaScript Object Reference
190
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 specif
y the color value for a page item in that document
using CMYK, Illustrator will translate the CMYK color spec
ification into an RGB color specification. The same
thing happens if the documents 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 documents
actual color space.
RGBColor properties
Setting an RGB color
HAPTER
1: JavaScript Object Reference
191
Screen
Associates a color separation screen with information to be used for printing.
Screen properties
PropertyValue type
What it is
name
string
The color separation screen name.
screenInfo
ScreenInfo
The color separation screen information.
typename
string
Read-only. The class
name of the object.
HAPTER
1: JavaScript Object Reference
ScreenInfo
192
ScreenInfo
Contains information about the angle and frequency of the color separation screen to be used for printing.
ScreenInfo properties
Getting screen information
// Displays in a new text frame, the name, angle and frequency
// of each screen list item
var sInfo = "";
var docRef = documents.add();
if(PPDFileList.length == 0){
var sInfo = "\r\t\tEmpty PPDFileList"
else{
var ppdRef = PPDFileList[0];
var ppdInfoRef = ppdRef.PPDInfo;
sInfo += "\r\t\tScreen Objects for 1st PPD File:\r";
sInfo += "\t\t" + ppdRef.name;
var iScreens = ppdInfoRef.screenList.length;
if(iScreens� 0){
for(var c=0; ciScreens; c++) {
var screenRef = ppdInfoRef.screenList[c];
sInfo += "\r\t\t";
sInfo += screenRef.name;
var screenInfoRef = screenRef.screenInfo;
sInfo += ", Angle = ";
sInfo += screenInfoRef.angle;
sInfo += ", Frequency = ";
sInfo += screenInfoRef.frequency;
sInfo += "\r";
else{
sInfo += "\r\t\tEmpty ScreenList";
var textRef = docRef.textFrames.add();
textRef.textRange.characterAttributes.size = 12;
textRef.contents = sInfo;
textRef.top = 600;
textRef.left = 30;
redraw();
Property
Value type
What it is
angle
number (double)
The screens angle in degrees.
defaultScreen
boolean
If
true
, it is the default screen.
frequency
number (double)
The screens frequency.
typename
string
Read-only. The class name of the object.
HAPTER
1: JavaScript Object Reference
ScreenSpotFunction
193
ScreenSpotFunction
Contains information about a color separation screen sp
ot function, including its definition in PostScript
language code.
ScreenSpotFunction properties
Finding screen spot functions
// Displays in a new text frame, the screen spot functions for the 1st PPD file.
var docRef = documents.add();
if(PPDFileList.length == 0){
var sInfo = "\r\t\tEmpty PPDFileList"
else{
var ppdRef = PPDFileList[0];
var ppdInfoRef = ppdRef.PPDInfo;
var sInfo = "\r\t\tScreenSpotFunctions for 1st PPD File:\r";
sInfo += "\t\t" + ppdRef.name + "\r";
var iScreenSpots = ppdInfoRef.screenSpotFunctionList.length;
if(iScreenS�pots 0 ){
for(var n=0; niScreenSpots; n++) {
var screenSpotRef = ppdInfoRef.screenSpotFunctionList[n];
sInfo += "\t\t";
sInfo += screenSpotRef.name;
sInfo += ", spotFunction: ";
sInfo += screenSpotRef.spotFunction;
sInfo += "\r";
else{
sInfo += "\t\tEmpty ScreenSpotFunctionList";
var textRef = docRef.textFrames.add();
textRef.textRange.characterAttributes.size = 12;
textRef.contents = sInfo;
textRef.top = 600;
textRef.left = 30;
redraw();
PropertyValue typeWhat it is
name
The color separation screen spot function name.
spotFunction
The spot function expressed in PostScript commands.
typename
Read-only. The class name of the object.
HAPTER
1: JavaScript Object Reference
Spot
194
A custom color definition contained in a
SpotColor
object.
If no properties are specified when creating a spot, de
fault 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 color information for this spot color.
colorType
ColorModel
The color model for this custom color.
name
string
The spot colors name.
parent
Document
Read-only. The document that contains this spot color.
spotKind
SpotColorKind
Read-only. The kind of spot color (RGB, CMYK or LAB). This is the name of
the color kind contained in the spot object.
typename
string
Read-only. The class name of the referenced object.
HAPTER
1: JavaScript Object Reference
Spot
195
Creating a new spot color
// Creates a new spot color in the current document, then applies an 80% tint to the
color
if ( app.documents.l�ength 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;
HAPTER
1: JavaScript Object Reference
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
PropertyValue typeWhat it is
spot
A reference to the spot color object that defines the color.
tint
number (double)
The tint of the color. Range: 0.0 to 100.0
typename
Read-only. The class name of the referenced object.
HAPTER
1: JavaScript Object Reference
197
A collection of
SpotColor
objects in a document.
Spots properties
Creates a new object.
Gets an element from the collection.
removeAll
HAPTER
1: JavaScript Object Reference
198
Creating and applying spot colors
// Defines and applies a new spot color in the current document then applies the color
// the first path item
if ( app.documents.l�ength 0 && app.activeDocument.pathItems�.length 0 ) {
// Define the new color value
newRGBColor = new RGBColor();
newRGBColor.red = 255;
newRGBColor.green = 0;
newRGBColor.blue = 0;
// Create the new spot
var newSpot = app.activeDocument.spots.add();
// Define the new SpotColor as 80% of the RGB color
newSpot.name = "Scripted Red spot";
newSpot.tint = 80;
newSpot.color = newRGBColor;
// Apply a 50% tint of the new spot color to the frontmost path item.
HAPTER
1: JavaScript Object Reference
199
Story
A contiguous block of text as specifie
d 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
Property
Value type
What it is
characters
Characters
Read-only. All the characters in this story.
insertionPoints
InsertionPoints
Read-only. All the insertion points in this story.
length
number (long)
Read-only. The number of characters in the story.
lines
Lines
Read-only. All the lines in this story.
paragraphs
Paragraphs
Read-only. All the paragraphs in this story.
parent
object
Read-only. The objects container.
textFrames
TextFrameItems
Read-only. The text frame items in this story.
textRange
TextRange
Read-only. The text range of the story.
textRanges
TextRanges
Read-only. All the text ranges in the story.
textSelection
array
TextRange
Read-only. The selected text ranges in the story.
typename
string
Read-only. The class name of the object.
words
Words
Read-only. All the words in the story.
HAPTER
1: JavaScript Object Reference
200
Threading text frames into stories
// Creates 1 story that flows through 2 text frames and another story that
// is displayed in a 3rd text frame
// Create a new document and add 2 area TextFrames
var docRef = documents.add();
var itemRef1 = docRef.pathItems.rectangle(600, 200, 50, 30);
var textRef1 = docRef.textFrames.areaText(itemRef1);
textRef1.selected = true;
// create 2nd text frame and link it the first
var itemRef2 = docRef.pathItems.rectangle(550, 300, 50, 200);
var textRef2 = docRef.textFrames.areaText(itemRef2, TextOrientation.HORIZONTAL,
textRef1);
textRef2.selected = true;
// Add enough text to the 1st TextFrame to
// cause it to flow to the 2nd TextFrame.
HAPTER
1: JavaScript Object Reference
201
Stories
A collection of
Story
objects in a document.
Stories properties
Stories methods
PropertyValue typeWhat it is
length
number
Read-only. Number of elements in the collection.
parent
objectRead-only. The objects container.
typename
string
Read-only. The class name of the object.
HAPTER
1: JavaScript Object Reference
202
Swatch
A color swatch definition contained in a document. Th
The color information for this swatch.
name
string
The swatchs name.
parent
Document
Read-only. The document that contains this swatch.
typename
string
Read-only. The class name of the referenced object.
HAPTER
1: JavaScript Object Reference
203
Swatches
A collection of
Swatch
objects in a document.
Swatches properties
Swatches methods
Creates a new
Swatch
object.
Gets selected swatches in the document.
index
(itemKey)string, number
Swatch
HAPTER
1: JavaScript Object Reference
SwatchGroup
204
SwatchGroup
A group of
Swatch
objects.
SwatchGroup properties
NothingAdds a spot swatch to the swatch group.
addSwatch
(swatch)
NothingAdds a swatch to the swatch group.
Gets a list of all swatches in the swatch group.
remove
HAPTER
1: JavaScript Object Reference
SwatchGroups
205
SwatchGroups
A collection of
SwatchGroup
objects.
SwatchGroups properties
SwatchGroups methods
PropertyValue typeWhat it is
length
Read-only. The number of objects in the collection
parent
objectRead-only. The parent of this object.
typename
Read-only. The class name of the referenced object.
Creates a swatch group.
HAPTER
1: JavaScript Object Reference
206
Symbol
Create a duplicate of this object.
remove
HAPTER
1: JavaScript Object Reference
207
SymbolItem
Is this object used to create a knockout, and if so, what
kind of knockout.
blendingMode
BlendModes
The blend mode used when compositing an object.
controlBounds
array
of 4 numbersRead-only. The bounds
of the object
including stroke
width and controls.
editable
boolean
Read-only. If
, this item is editable.
Read-only. The layer to which this item belongs.
left
number (double)
The position of the left side of the item (in points,
measured from the left side of the page).
locked
boolean
If
, this item is locked.
name
string
The name of this item.
note
string
The note assigned to this item.
opacity
number (double)
The opacity of the object. Range: 0.0 to 100.0
parent
Layer
GroupItem
Read-only. The parent of this object.
position
array
of 2 numbersThe 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
, this item is selected.
sliced
boolean
If
, the item sliced. Default:
symbol
Symbol
The symbol that was used to create this
symbolItem
tags
Tags
Read-only. The tags co
ntained in this item.
number (double)
The position of the top of the item (in points,
measured from the bottom of the page).
HAPTER
1: JavaScript Object Reference
208
SymbolItem
Creates a duplicate of the
selected object.
move
(relativeObject,
insertionLocation)
object
ElementPlacement
SymbolItem
Moves the object.
remove
NothingScales the art item where
scaleX
is the horizontal
scaling factor and
scaleY
the vertical scaling factor.
100.0 = 100%.
HAPTER
1: JavaScript Object Reference
209
rotate
(angle
[,changePositions]
[,changeFillPatterns]
[,changeFillGradients]
[,changeStrokePattern]
[,rotateAbout])
number (double)
boolean
boolean
boolean
boolean
Transformation
NothingRotates the art item relative
to the current rotation. The
object is rotated
counter-clockwise if the
value is positive,
clockwise if the value is
negative.
transform
(transformationMatrix
[,changePositions]
[,changeFillPatterns]
[,changeFillGradients]
[,changeStrokePattern]
[,changeLineWidths]
[,transformAbout])
Matrix
boolean
boolean
boolean
boolean
number (double)
Transformation
NothingTransforms the art item by
applying a transformation
matrix.
translate
([deltaX]
[,deltaY]
[,transformObjects]
[,transformFillPatterns]
[,transformFillGradients]
[,transformStrokePatterns])
number (double)
number (double)
boolean
boolean
boolean
boolean
NothingRepositions the art item
relative to the current
position, where
deltaX
NothingArranges the art items
position in the stacking
order of the group or layer
(parent) of this object.
HAPTER
1: JavaScript Object Reference
SymbolItems
210
SymbolItems
A collection of
SymbolItem
objects in the document.
SymbolItems properties
SymbolItem
Creates an instance of the specified symbol.
HAPTER
1: JavaScript Object Reference
211
Symbols
The collection of
Symbol
objects in the document.
Symbols properties
SymbolRegistrationPoint
Symbol
Returns a symbol object
created from the source art
item, any of the following:
CompoundPathItems
GroupItems
MeshItems
NonNativeItems
PageItems
PathItems
RasterItems
SymbolItems
TextFrameItems
The default registration
point is
SymbolCenterPoint
index
(itemKey)
string, number
Symbol
Gets an element from the
collection.
HAPTER
1: JavaScript Object Reference
212
Creating a symbol
// Creates a path item from each graphic style
// then adds each item as a new symbol
var docRef = documents.add();
var y = 750;
var x =25;
var iCount = docRef.graphicStyles.length;
for(var i=0; iiCount; i++) {
var pathRef = docRef.pathItems.rectangle( y, x, 20, 20 );
docRef.graphicStyles[i].applyTo(pathRef);
if( (y-=60) = 60 ) {
y = 750; // go back to the top.
x+= 200
redraw();
docRef.symbols.add(pathRef);
HAPTER
1: JavaScript Object Reference
TabStopInfo
213
TabStopInfo
The alignment of the tab stop. Default:
Left
decimalCharacter
string
The character used for decimal tab stops. Default:
leader
string
The leader dot character.
position
number (double)
The position of the tab stop expressed in points.
Default:0.0
typename
string
Read-only. The class name of the object.
HAPTER
1: JavaScript Object Reference
Tag
214
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.l�ength 0 ) {
doc = app.activeDocument;
if ( doc.selection.l�ength 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();
HAPTER
1: JavaScript Object Reference
Tag
215
HAPTER
1: JavaScript Object Reference
216
Tags
A collection of
Tag
objects.
Tags properties
Tags methods
Setting tag values
// Adds tags to all RasterItems and PlacedItems in the current document
if ( app.documents.l�ength 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" );
PropertyValue typeWhat it is
length
number
Read-only. The number of objects in the collection.
parent
objectRead-only. The parent of this object.
typename
string
Read-only. The class name of the referenced object.
Creates a new
Tag
object.
Gets an element from the collection.
removeAll
HAPTER
1: JavaScript Object Reference
TextFont
217
TextFont
Information about a font in the document, found in a
CharacterAttributes
object.
TextFont properties
Setting the font of text
HAPTER
1: JavaScript Object Reference
TextFonts
218
TextFonts
A collection of
TextFont
objects.
TextFonts properties
TextFonts methods
Finding fonts
// Creates a new A3 sized document and display a list of available fonts until the
document is full.
var edgeSpacing = 10;
var columnSpacing = 230;
HAPTER
1: JavaScript Object Reference
TextFonts
219
if ((x + textRef�.width) docRef.width){
textRef.remove();
iCount = i;
break;
else{
// display text frame
textRef.textRange.characterAttributes.textFont =
HAPTER
1: JavaScript Object Reference
220
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
frames
property.
When you create a text frame, you also create a
object. However, threading text frames combines the
frames into a single story obje
ct. To thread frames, use the
or
previousFrame
property.
TextFrameItem properties
Property
Value typeWhat it is
anchor
array
of 2 numbersThe position of the anchor point, the start of the
base line for point text.
antialias
TextAntialias
The type of anti-aliasing to use in the text.
characters
Characters
Read-only. All the characters in this text frame.
columnCount
number (long)
The column count in the text frame (area text only).
columnGutter
number (double)
The column gutter in the text frame (area text only).
contents
string
The text string.
contentVariable
Variable
The content variable bound to this text frame item.
endTValue
number (double)
The end position of text along a path, as a value
relative to the paths segments (path text only).
flowLinksHorizontally
boolean
If
, flow text between linked frames horizontally
first (area text only).
insertionPoints
InsertionPoints
Read-only. All the insertion points in this text range.
kind
TextType
Read-only. The type of a text frame item (area, path
or point).
lines
Lines
Read-only. All the lines in this text frame.
matrix
Matrix
Read-only. The transformation matrix for this text
frame.
nextFrame
TextFrameItem
The linked text frame following this one.
opticalAlignment
boolean
If
true
, the optical alignment feature is active.
orientation
TextOrientation
The orientation of the text.
paragraphs
Paragraphs
Read-only. All the paragraphs in this text frame.
parent
Layer
GroupItem
Read-only. The parent of this object.
previousFrame
TextFrameItem
The linked text frame preceding this one.
rowCount
number (long)
The row count in the text frame (area text only).
HAPTER
1: JavaScript Object Reference
221
Read-only. The story to which the text frame
belongs.
textPath
TextPath
The path item associated with the text frame. Note:
Valid only when
is area or path.
textRange
TextRange
Read-only. The text range of the text frame.
textRanges
TextRanges
Read-only. All the text in this text frame.
textSelection
array
TextRange
Read-only. The selected text range(s) in the text
frame.
typename
string
Read-only. The class name
of the referenced object.
words
Words
Read-only. All the words in this text frame.
PropertyValue typeWhat it is
Item
Converts the area-type
text frame to a point-type
text frame.
convertPointObjectToAreaObject
TextFrame
Item
Converts the point-type
text frame to an area-type
text frame.
createOutline
GroupItem
Converts the text in the
text frame to outlines.
duplicate
([relativeObject]
[,insertionLocation])
object
ElementPlacement
TextRange
Creates a duplicate of the
selected object.
move
(relativeObject,
insertionLocation)
object
ElementPlacement
TextRange
Moves the object.
remove
HAPTER
1: JavaScript Object Reference
222
resize
(scaleX,
[,changePositions]
[,changeFillPatterns]
[,changeFillGradients]
[,changeStrokePattern]
[,changeLineWidths]
[,scaleAbout])
number (double)
number (double)
boolean
boolean
boolean
boolean
number (double)
Transformation
NothingScales the art item where
is the horizontal
scaling factor and
scaleY
is the vertical scaling
factor. 100.0 = 100%.
rotate
(angle
[,changePositions]
[,changeFillPatterns]
[,changeFillGradients]
[,changeStrokePattern]
[,rotateAbout])
number (double)
boolean
boolean
boolean
boolean
Transformation
NothingRotates the art item
relative to the current
rotation. The object is
rotated counter-clockwise
value is
positive, clockwise if the
value is negative.
transform
(transformationMatrix
[,changePositions]
[,changeFillPatterns]
[,changeFillGradients]
[,changeStrokePattern]
[,changeLineWidths]
[,transformAbout])
boolean
boolean
boolean
boolean
number (double)
Transformation
NothingTransforms the art item by
applying a transformation
translate
([deltaX]
[,deltaY]
[,transformObjects]
[,transformFillPatterns]
[,transformFillGradients]
[,transformStrokePatterns])
number (double)
number (double)
boolean
boolean
boolean
boolean
NothingRepositions the art item
relative to the current
position, where
NothingArranges the art items
position in the stacking
order of the group or layer
(parent) of this object.
HAPTER
1: JavaScript Object Reference
223
Rotate a text art item
// Duplicates and rotates the selected text art item 5 times
if ( app.documents.l�ength 0 ) {
selectedItems = app.activeDocument.selection;
HAPTER
1: JavaScript Object Reference
224
TextFrameItems
A collection of
TextFrameItem
objects.
TextFrameItems properties
Creates a point text frame item.
areaText
(textPath
[,orientation]
[,baseFrame]
[,postFix])
TextOrientation
TextFrameItem
TextFrame
Creates an area text frame item.
number (double)
number (double)
TextOrientation
TextFrameItem
TextFrame
Creates an on-path text frame item.
pointText
(anchor
[,orientation])
of 2 numbers
TextOrientation
TextFrame
Creates a point text frame item.
removeAll
HAPTER
1: JavaScript Object Reference
225
Creating and modifying text frames
// Creates a document with text frames displaying path, area and point
HAPTER
1: JavaScript Object Reference
TextPath
226
TextPath
A path or list of paths for area or path text. A path
The blend mode used when compositing an object.
clipping
boolean
If
, this path should be used as a clipping path.
closed
boolean
If
, this path is closed.
editable
boolean
Read-only. If
true
, this item is editable.
evenodd
boolean
If
, the even-odd rule should be used to
The fill color of the path.
filled
boolean
If
, the path be filled.
fillOverprint
boolean
If
, the art beneath a filled object should be
overprinted.
guides
boolean
If
, this path is a guide object.
height
number (double)
The height of the group item.
left
number (double)
The position of the left side of the item (in points,
measured from the left side of the page).
note
string
The note text assigned to the path.
opacity
number (double)
The opacity of the object. Range: 0.0 to 100.0
parent
Layer
GroupItem
Read-only. The parent of this object.
pathPoints
PathPoints
Read-only. The path points contained in this path
item.
polarity
PolarityValues
The polarity of the path.
position
array
of 2 numbersThe position (in points) of the top left corner of the
textPathItem
object in the format [x, y]. Does not
include stroke weight.
resolution
number (double)
The resolution of the path in dots per inch (dpi).
selectedPathPoints
PathPoints
Read-only. All of the selected path points in the path.
HAPTER
1: JavaScript Object Reference
TextPath
227
The type of line capping.
strokeColor
Color
The stroke color for the path.
stroked
boolean
If
, the path should be stroked.
strokeDashes
object
Dash lengths. Set to an empty object,
, for a solid
line.
Type of joints for the path.
strokeMiterLimit
number (double)
HAPTER
1: JavaScript Object Reference
TextRange
228
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
Property
Value type
What it is
characterAttributes
CharacterAttributes
Read-only. The character properties for the text
range.
Read-only. All the characters in this text range.
characterStyles
CharacterStyles
Read-only. All referenced character styles in the
text range.
contents
string
The text string.
insertionPoints
InsertionPoints
Read-only. All the insertion points in this text
range.
kerning
number (long)
Controls the spacing between two characters,
in thousandths of an em. An integer.
length
number (long)
The length (in characters). Minimum: 0
lines
Lines
Read-only. All the lines in this text range.
paragraphAttributes
ParagraphAttributes
Read-only. The paragraph properties for the
text range.
paragraphs
Paragraphs
Read-only. All the paragraphs in this text range.
paragraphStyles
ParagraphStyles
Read-only. All referenced paragraph styles in
the text range.
parent
TextRange
Read-only. The objects container.
story
Story
Read-only. The story to which the text range
belongs.
textRanges
TextRanges
Read-only. All of the text in this text range.
textSelection
array
TextRange
Read-only. The selected text ranges in the text
range.
typename
string
Read-only. The class name o f the object.
words
Words
Read-only. All the words contained in this text
range.
HAPTER
1: JavaScript Object Reference
TextRange
229
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.l�ength 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.
NothingChanges the capitalization of text.
deSelect
NothingDeselects the text range.
duplicate
([relativeObject]
[,insertionLocation])
object
ElementPlacement
TextRange
Creates a duplicate of this object.
move
(relativeObject,
insertionLocation)
object
ElementPlacement
TextRange
Moves the object.
remove
NothingDeletes the object.
select
([addToDocument])boolean
NothingSelects the text range. If
addToDocument
, adds this
to the current selection; otherwise
replaces the current selection.
HAPTER
1: JavaScript Object Reference
TextRanges
230
TextRanges
A collection of
TextRange
objects.
TextRanges properties
TextRanges methods
PropertyValue typeWhat it is
length
Read-only. Number of elements in the collection.
parent
objectRead-only. The objects container.
typename
Read-only. The class name of the object.
HAPTER
1: JavaScript Object Reference
TracingObject
231
TracingObject
A tracing object, which associates sour
ce raster art item with a vector-art plug-in group created by tracing.
Scripts can initiate tracing using
PlacedItem.trace
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 oper
ation by calling the applications
redraw
RasterItem
The raster art used to create the associated vector art plug-in
group.
tracingOptions
TracingOptions
The options used to convert the raster artwork to vector art.
typename
Read-only. The class name of the object.
usedColorCount
number (long)
Read-only. The number of colors used in the tracing result.
HAPTER
1: JavaScript Object Reference
TracingObject
232
TracingObject methods
Method
Parameter typeReturnsWhat it does
expandTracing
([viewed])boolean
GroupItem
Converts the vector art into a new group item.
The new
GroupItem
object replaces the
PluginItem
object in the document. By default,
viewed
, and the new group contains
only the tracing result (the filled or stroked
paths). If
viewed
true
, the new group retains
additional information that was specified for the
viewing mode, such as outlines and overlays.
Deletes this object and its associated
PluginItem
object. Any group-level attributes
that were applied to the plug-in item are
applied to the top level of the new group item.
RasterItem
Reverts the artwork in the document to the
original source raster art and removes the
traced vector art. Returns the original object
used to create the tracing, and deletes this
object and its associated
PluginItem
object.
HAPTER
1: JavaScript Object Reference
TracingOptions
233
TracingOptions
HAPTER
1: JavaScript Object Reference
TracingOptions
234
The color mode for tracing.
typename
Read-only. The class name of the object.
viewRaster
ViewRasterType
HAPTER
1: JavaScript Object Reference
Variable
235
Variable
A document-level variable that
can be imported or exported.
A variable is a dynamic object used to crea
te data-driven graphics. For an example, see
. Variables
The variables type.
name
string
The name of the variable.
pageItems
PageItems
Read-only. All of the artwork in the variable.
parent
object
Read-only. The object that contains the variable.
typename
string
Read-only. The class name of the referenced object.
HAPTER
1: JavaScript Object Reference
236
Variables
The collection of
Variable
objects in the document. For an example of how to create variables, see
Using
variables and datasets
Variables properties
HAPTER
1: JavaScript Object Reference
237
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 properti
es of existing views, including the center point,
screen mode, and zoom.
View properties
Setting a view to full screen
Read-only. The document that contains this view.
screenMode
ScreenMode
The mode of display for this view.
typename
Read-only. The class name
of the referenced object.
zoom
number (double)
The zoom factor of this view, where 100.0 is 100%.
HAPTER
1: JavaScript Object Reference
238
Views
A collection of
View
objects in a document.
Views properties
Views methods
PropertyValue typeWhat it is
length
Read-only. The number of objects in the collection.
parent
objectRead-only. The parent of this object.
typename
Read-only. The class name of the referenced object.
HAPTER
1: JavaScript Object Reference
Words
239
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.l�ength 0 ) {
numWords = 0;
for ( i = 0; i app.activeDocument.textFrames.length; i++) {
numWords += app.activeDocument.textFrames[i].words.length;
PropertyValue typeWhat it is
length
number
Read-only. The number of objects in the collection.
parent
objectRead-only. The parent of this object.
typename
string
Read-only. The class name of the referenced object.
ElementPlacement
TextRange
Adds a word to the current
document at the specified
location. If no location is specified,
adds it to the containing text
frame after the current word
selection or insertion point.
addBefore
(contents)
TextRange
Adds a word before the current
word selection or insertion point.
index
(itemKey)
TextRange
HAPTER
1: JavaScript Object Reference
Words
240
Applying attributes to words
241
Scripting Constants
This chapter lists and describes the enumerations define
d for use with Illustrator
JavaScript properties and
HAPTER
2: Scripting Constants
242
AutoCADCompatibility
AutoCADRelease13AutoCADRelease18
AutoCADRelease14AutoCADRelease21
AutoCADRelease15AutoCADRelease24
AutoCADExportFileFormat
DXFDWG
AutoCADExportOption
PreserveAppearance
MaximizeEditability
AutoCADGlobalScaleOption
OriginalSizeScaleByValue
FitArtboard
AutoCADRasterFormat
PNGJPEG
AutoCADUnit
HAPTER
2: Scripting Constants
243
BlendsExpandPolicy
Policy used by FXG file format to
expand blends.
AUTOMATICALLYCONVERTBLENDS
RASTERIZEBLENDS
BurasagariTypeEnum
ForcedStandard
HAPTER
2: Scripting Constants
244
ColorType
CMYKPATTERN
RGB
SPOT
The color specification for an
individual color.
Compatibility
ILLUSTRATOR8ILLUSTRATOR12
ILLUSTRATOR9ILLUSTRATOR13
ILLUSTRATOR10ILLUSTRATOR14
ILLUSTRATOR11ILLUSTRATOR15
ILLUSTRATOR16ILLUSTRATOR17
JAPANESEVERSION3
The version of the Illustrator file to
create when saving an EPS or
Illustrator file
CompressionQuality
AUTOMATICJPEG2000HIGHJPEG2000LOW
AUTOMATICJPEG2000LOSSLESSJPEG2000MAXIMUM
AUTOMATICJPEG2000LOWJPEG2000MEDIUM
AUTOMATICJPEG2000MAXIMUMJPEG2000MINIMUM
AUTOMATICJPEG2000MEDIUMJPEGHIGH
AUTOMATICJPEG2000MINIMUMJPEGLOW
AUTOMATICJPEGHIGH
JPEGMAXIMUM
AUTOMATICJPEGLOW
JPEGMEDIUM
AUTOMATICJPEGMAXIMUMJPEGMINIMUM
AUTOMATICJPEGMEDIUMZIP4BIT
AUTOMATICJPEGMINIMUMZIP8BIT
JPEG2000HIGH
None
JPEG2000LOSSLESS
The quality of bitmap compression
used when saving a PDF file
CoordinateSystem
DOCUMENTCOORDINATESYSTEM
ARTBOARDCOORDINATESYSTEM
The coordinate system used by
Illustrator
CropOptions
The style of a documents cropping
box
DocumentArtboardLayout
GridByRowRLGridByRow
GridByColRLGridByCol
RowRLRow
The layout of in the new document.
DocumentColorSpace
CMYKRGB
The color space of a document
DocumentLayoutStyle
CASCADEFLOATALL
HORIZONTALTILECONSOLIDATEALL
VERTICALTILE
The layout style for a document.
Constant
TypeValuesWhat it means
HAPTER
2: Scripting Constants
245
HAPTER
2: Scripting Constants
246
ExportType
FLASHPNG24
PNG8
SVG
Photoshop
TIFF
The file format used to export a file
FigureStyleType
DEFAULTFIGURESTYLETABULAR
PROPORTIONALTABULAROLDSTYLE
PROPORTIONALOLDSTYLE
FiltersPreservePolicy
EXPANDFILTERS
KEEPFILTERSEDITABLE
RASTERIZEFILTERS
The filters preserve policy used by the
FXG file format.
FlashExportStyle
ASFLASHFILELAYERSASSYMBOLS
LAYERSASFRAMESTOFILES
LAYERSASFILES
The method used to convert Illustrator
images when exporting files
FlashExportVersion
FlashVersion1FlashVersion6
FlashVersion2FlashVersion7
FlashVersion3FlashVersion8
FlashVersion4FlashVersion9
FlashVersion5
Version for exported SWF file
FlashImageFormat
The format used to store flash images
FlashJPEGMethod
Optimized
HAPTER
2: Scripting Constants
247
FontOpenTypePositionOption
DENOMINATOROPENTYPESUBSCRIPT
NUMERATOR
OPENTYPESUPERSCRIPT
OPENTYPEDEFAULT
FontSubstitutionPolicy
SUBSTITUTEDEVICE
SUBSTITUTEOBLIQUE
HAPTER
2: Scripting Constants
248
KinsokuOrderEnum
PUSHOUTONLY
PUSHOUTFIRST
KnockoutState
DISABLEDINHERITED
ENABLEDUnknown
The type of knockout to use on a page
item
HAPTER
2: Scripting Constants
249
PageMarksTypes
PathPointSelection
ANCHORPOINT
NOSELECTION
LEFTDIRECTION
RIGHTDIRECTION
LEFTRIGHTPOINT
Which points, if any, of a path are
selected
PDFBoxType
PDFARTBOXPDFCROPBOX
PDFBLEEDBOXPDFMEDIABOX
PDFBOUNDINGBOXPDFTRIMBOX
PDFChangesAllowedEnum
CHANGE128ANYCHANGESCHANGE40ANYCHANGES
CHANGE128COMMENTINGCHANGE40COMMENTING
CHANGE128EDITPAGECHANGE40PAGELAYOUT
CHANGE128FILLFORMCHANGE40NONE
CHANGE128NONE
PDFCompatibility
ACROBAT4ACROBAT7
ACROBAT5ACROBAT8
The version of the Acrobat file format
to create when saving a PDF file
PDFOverprint
DISCARDPDFOVERPRINT
PRESERVEPDFOVERPRINT
PDFPrintAllowedEnum
PRINT128HIGHRESOLUTION
PRINT128LOWRESOLUTION
PRINT128NONE
PRINT40HIGHRESOLUTION
PRINT40NONE
PDFTrimMarkWeight
TRIMMARKWEIGHT0125
TRIMMARKWEIGHT05
TRIMMARKWEIGHT025
PDFXStandard
PDFXNONEPDFX32002
PDFX1A2001PDFX32003
PDFX1A2003PDFX42007
Constant
TypeValuesWhat it means
HAPTER
2: Scripting Constants
250
PerspectiveGridType
OnePointPerspectiveGridType
TwoPointPerspectiveGridType
ThreePointPerspectiveGridType
InvalidPerspectiveGridType
HAPTER
2: Scripting Constants
251
PrinterColorMode
BLACKANDWHITEPRINTER
GRAYSCALEPRINTER
COLORPRINTER
PrinterPostScriptLevelEnum
PrinterTypeEnum
NONPOSTSCRIPTPRINTER
POSTSCRIPTPRINTER
PrintFontDownloadMode
DOWNLOADNONE
HAPTER
2: Scripting Constants
252
RulerUnits
HAPTER
2: Scripting Constants
253
SVGDTDVersion
SVG1_0SVGTINY1_1
SVGTINY1_1PLUS
SVGBASIC1_1
SVGTINY1_2
SVB version compatibility for exported
HAPTER
2: Scripting Constants
254
TIFFByteOrder
MACINTOSH
The byte order to use for an exported
TIFF file.
TracingModeType
TRACINGMODEBLACKANDWHITE
TRACINGMODECOLOR
TRACINGMODEGRAY
Transformation
BOTTOMLEFT
BOTTOMLEFTRIGHT
BOTTOMRIGHTTOP
CENTERTOPLEFT
DOCUMENTORIGINTOPRIGHT
The point to use as the anchor point
about which an object is rotated,
resized, or transformed
TrappingType
IGNOREOPAQUEOPAQUE
NORMALTRAPPINGTRANSPARENT
UserInteractionLevel
DISPLAYALERTS
DONTDISPLAYALERTS
HAPTER
2: Scripting Constants
255

Приложенные файлы

  • pdf 10970314
    Размер файла: 887 kB Загрузок: 1

Добавить комментарий