Adobe InDesign CS4 (6.0) Object Model JS: Graphic

InDesign CS4

Class

Graphic

 

An imported graphic in any graphic file format (including vector, metafile, and bitmap formats).

Superclass of EPS, Image, ImportedPage, PDF, PICT, and WMF

QuickLinks

applyObjectStyle, autoTag, changeObject, clearObjectStyleOverrides, detach, duplicate, exportFile, exportForWeb, extractLabel, findObject, fit, flipItem, getElements, insertLabel, markup, move, override, place, placeXML, redefineScaling, reframe, remove, removeOverride, resize, resolve, toSource, toSpecifier, transform, transformAgain, transformAgainIndividually, transformSequenceAgain, transformSequenceAgainIndividually, transformValuesOf

Hierarchy

GraphicLine | Group | Oval | PageItem | Polygon | Rectangle | State
Graphic
EPS | Image | ImportedPage | PDF | PICT | WMF
Link

Properties

PropertyTypeAccessDescription
absoluteFlipFlip:
Flip.NONE
Flip.HORIZONTAL
Flip.VERTICAL
Flip.HORIZONTAL_AND_VERTICAL
Flip.BOTH
r/wIndicates whether the Graphic has been flipped independently of its parent object and, if yes, the direction in which the Graphic was flipped.
absoluteHorizontalScalenumber r/wThe horizontal scale of the Graphic relative to its containing object.
absoluteRotationAnglenumber r/wThe rotation angle of the Graphic relative to its containing object. (Range: -360 to 360)
absoluteShearAnglenumber r/wThe skewing angle of the Graphic relative to its containing object. (Range: -360 to 360)
absoluteVerticalScalenumber r/wThe vertical scale of the Graphic relative to its containing object.
allowOverridesbool r/wIf true, the master page item can be overridden.
appliedObjectStyleObjectStyle r/wThe object style applied to the Graphic.
associatedXMLElementXMLItem readonlyThe XML element associated with the Graphic.
flipFlip:
Flip.NONE
Flip.HORIZONTAL
Flip.VERTICAL
Flip.HORIZONTAL_AND_VERTICAL
Flip.BOTH
r/wThe direction in which to flip the printed image.
geometricBoundsArray of Measurement Unit (Number or String) r/wThe bounds of the Graphic excluding the stroke width, in the format [y1, x1, y2, x2], which give the coordinates of the top-left and bottom-right corners of the bounding box.
horizontalScalenumber r/wThe horizontal scaling applied to the text as a percentage of its current size. (Range: 1 to 1000)
idnumber readonlyThe unique ID of the Graphic.
imageTypeNamestring readonlyThe type of the image.
indexnumber readonlyThe index of the Graphic within its containing object.
isValidbool readonlyReturns true if the object specifier resolves to valid objects.
itemLinkLink readonlyThe source file of the link.
labelstring r/wA property that can be set to any string.
localDisplaySettingDisplaySettingOptions:
DisplaySettingOptions.HIGH_QUALITY
DisplaySettingOptions.TYPICAL
DisplaySettingOptions.OPTIMIZED
DisplaySettingOptions.DEFAULT_VALUE
r/wDisplay performance options for the Graphic.
overriddenbool readonlyIf true, the object originated on a master spread and was overridden. If false, the object either originated on a master spread and was not overridden, or the object did not originate on a master page.
overriddenMasterPageItemGraphic
Guide
Movie
PageItem
Sound
readonlyAn object that originated on a master page and has been overridden. Can return: PageItem, Guide, Graphic, Movie or Sound.
parentGraphicLine
Group
Oval
PageItem
Polygon
Rectangle
State
readonlyThe parent of the Graphic (a PageItem, Oval, Rectangle, Polygon, GraphicLine, State or Group).
propertiesObject r/wA property that allows setting of several properties at the same time.
rotationAnglenumber r/wThe rotatation angle of the Graphic. (Range: -360 to 360)
shearAnglenumber r/wThe skewing angle applied to the Graphic. (Range: -360 to 360)
verticalScalenumber r/wThe vertical scaling applied to the text as a percentage of its current size. (Range: 1 to 1000)
visibleBoundsArray of Measurement Unit (Number or String) r/wThe bounds of the Graphic including the stroke width, in the format [y1, x1, y2, x2], which give the coordinates of the top-left and bottom-right corners of the bounding box.

Methods

Instances

void applyObjectStyle (using: ObjectStyle[, clearingOverrides: bool=true][, clearingOverridesThroughRootObjectStyle: bool=false])
Applies the specified object style.

ParameterTypeDescription
usingObjectStyleThe object style to apply.
clearingOverridesboolIf true, clears the Graphic's existing attributes before applying the style. (Optional) (default: true)
clearingOverridesThroughRootObjectStyleboolIf true, clears attributes and formatting applied to the Graphic that are not defined in the object style. (Optional) (default: false)

void autoTag ()
Tag the object or the parent story using default tags defined in XML preference.

Array of PageItem changeObject ([reverseOrder: bool])
Finds objects that match the find what value and replace the objects with the change to value.

ParameterTypeDescription
reverseOrderboolIf true, returns the results in reverse order. (Optional)

void clearObjectStyleOverrides ()
Clear overrides for object style

void detach ()
Detaches an overridden master page item from the master page.

PageItem duplicate ([to: any][, by: Array of Measurement Unit (Number or String)])
Duplicates the Graphic at the specified location or offset.

ParameterTypeDescription
toArray of 2 Units
Layer
Page
Spread
The location of the new Graphic, specified in coordinates in the format [x, y]. Can accept: Array of 2 Units, Spread, Page or Layer. (Optional)
byArray of Measurement Unit (Number or String)Amount by which to offset the new Graphic from the original Graphic's position. (Optional)

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

ParameterTypeDescription
formatExportFormat
String
The export format, specified as an enumeration value or as an extension that appears in the Save as type or Format menu in the Export dialog. Can accept: ExportFormat enumerator or String.
toFileThe path to the export file.
showingOptionsboolIf true, displays the export options dialog. (Optional) (default: false)
usingPDFExportPresetThe export style. (Optional)
versionCommentsstringThe comment for this version. (Optional)
forceSaveboolIf true, forcibly saves a version. (Optional) (default: false)

Array of string exportForWeb (to: File)
Exports the Graphic for the web.

ParameterTypeDescription
toFileThe full path name of the exported file.

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

ParameterTypeDescription
keystringThe key.

Array of PageItem findObject ([reverseOrder: bool])
Finds objects that match the find what value.

ParameterTypeDescription
reverseOrderboolIf true, returns the results in reverse order. (Optional)

void fit (given: FitOptions)
Applies the specified fit option to content in a frame.

ParameterTypeDescription
givenFitOptions:
FitOptions.CONTENT_TO_FRAME
FitOptions.CENTER_CONTENT
FitOptions.PROPORTIONALLY
FitOptions.FRAME_TO_CONTENT
FitOptions.FILL_PROPORTIONALLY
FitOptions.APPLY_FRAME_FITTING_OPTIONS
The fit option to use.

void flipItem (given: Flip[, around: any])
Flips the Graphic.

ParameterTypeDescription
givenFlip:
Flip.NONE
Flip.HORIZONTAL
Flip.VERTICAL
Flip.HORIZONTAL_AND_VERTICAL
Flip.BOTH
The axis around which to flip the Graphic.
aroundAnchorPoint
Array of 2 Units
The point around which to flip the Graphic. Can accept: Array of 2 Units or AnchorPoint enumerator. (Optional)

Array of Graphic getElements ()
Resolves the object specifier, creating an array of object references.

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

ParameterTypeDescription
keystringThe key.
valuestringThe value.

void markup (using: XMLElement)
Associates the page item with the specified XML element while preserving existing content.

ParameterTypeDescription
usingXMLElementThe XML element.

void move ([to: any][, by: Array of Measurement Unit (Number or String)])
Moves the Graphic to a new location. Note: Either the 'to' or 'by' parameter is required; if both parameters are defined, only the to value is used.

ParameterTypeDescription
toArray of 2 Units
Layer
Page
Spread
The new location of the Graphic,in the format (x, y). Can accept: Array of 2 Units, Spread, Page or Layer. (Optional)
byArray of Measurement Unit (Number or String)The amount (in measurement units) to move the Graphic relative to its current position, in the format (x, y). (Optional)

any override (destinationPage: Page)
Overrides a master page item and places the item on the document page as a new object.

ParameterTypeDescription
destinationPagePageThe document page that contains the master page item to override.

Array of any place (fileName: File[, showingOptions: bool=false][, withProperties: Object])
Places the file.

ParameterTypeDescription
fileNameFileThe file to place
showingOptionsboolWhether to display the import options dialog (Optional) (default: false)
withPropertiesObjectInitial values for properties of the placed object(s) (Optional)

void placeXML (using: XMLElement)
Places XML content into the specified object. Note: Replaces any existing content.

ParameterTypeDescription
usingXMLElementThe XML element whose content you want to place.

void redefineScaling ([to: Array of number])
Apply an item's scaling to its content if possible.

ParameterTypeDescription
toArray of numberThe scale factors to be left on the item. The default is {1.0, 1.0}. (Optional)

void reframe (in: any, opposingCorners: Array of any)
Move the bounding box of the page item

ParameterTypeDescription
inboundsKind:BoundingBoxLimits
CoordinateSpaces
Ordered array containing coordinateSpace:CoordinateSpaces
The bounding box to resize. Can accept: CoordinateSpaces enumerator or Ordered array containing coordinateSpace:CoordinateSpaces enumerator, boundsKind:BoundingBoxLimits enumerator.
opposingCornersArray of any Opposing corners of new bounding box in the given coordinate space

void remove ()
Deletes the Graphic.

void removeOverride ()
Removes the override from a previously overridden master page item.

void resize (in: any, from: any, by: ResizeMethods, values: Array of any[, resizeIndividually: bool=true][, consideringRulerUnits: bool=false])
Resize the page item.

ParameterTypeDescription
inBoundingBoxLimits
boundsKind:BoundingBoxLimits
CoordinateSpaces
Ordered array containing coordinateSpace:CoordinateSpaces
The bounding box to resize. Can accept: CoordinateSpaces enumerator, BoundingBoxLimits enumerator or Ordered array containing coordinateSpace:CoordinateSpaces enumerator, boundsKind:BoundingBoxLimits enumerator.
fromAnchorPoint
AnchorPoint
Array of 2 Reals
Array of Arrays of 2 Reals
BoundingBoxLimits
CoordinateSpaces
Long Integers
The transform origin. Legal specifications: relative to bounding box: anchor | {anchor | {x,y}, bounds kind [, coordinate space]}; relative to coordinate space: {x,y} | {{x,y}[, coordinate space]}; relative to layout window ruler: {{x,y}, page index | bounds kind}. Can accept: Array of 2 Reals, AnchorPoint enumerator or Array of Arrays of 2 Reals, CoordinateSpaces enumerators, AnchorPoint enumerators, BoundingBoxLimits enumerators or Long Integers.
byResizeMethods:
ResizeMethods.ADDING_CURRENT_DIMENSIONS_TO
ResizeMethods.MULTIPLYING_CURRENT_DIMENSIONS_BY
ResizeMethods.REPLACING_CURRENT_DIMENSIONS_WITH
How the current dimensions are affected by the given values
valuesArray of :
Array of Reals
CoordinateSpaces
ResizeConstraints
The width and height values. Legal dimensions specifications: {x, y [, coordinate space]}, {x, resize constraint [, coordinate space]}, or {resize constraint, y [, coordinate space]}; where x and y are real numbers and coordinate space is used to determine _only_ the unit of length for x and y; coordinate space is ignored for the 'current dimensions times' resize method). Can accept: Array of Reals, ResizeConstraints enumerators or CoordinateSpaces enumerators.
resizeIndividuallyboolIf false and multiple page items are targeted, the new dimensions are attained only by moving the individual items rather than resizing them. (Optional) (default: true)
consideringRulerUnitsboolIf true then a ruler location is interpreted using ruler units rather than points. The default value is false. This parameter has no effect unless the reference point is specified relative to a page. (Optional) (default: false)

any resolve (location: any, in: CoordinateSpaces[, consideringRulerUnits: bool=false])
Get the coordinates of the given location in the specified coordinate system.

ParameterTypeDescription
locationAnchorPoint
AnchorPoint
Array of 2 Reals
Array of Arrays of 2 Reals
BoundingBoxLimits
CoordinateSpaces
Long Integers
The location requested. Can accept: Array of 2 Reals, AnchorPoint enumerator or Array of Arrays of 2 Reals, CoordinateSpaces enumerators, AnchorPoint enumerators, BoundingBoxLimits enumerators or Long Integers.
inCoordinateSpaces:
CoordinateSpaces.PASTEBOARD_COORDINATES
CoordinateSpaces.PARENT_COORDINATES
CoordinateSpaces.INNER_COORDINATES
CoordinateSpaces.SPREAD_COORDINATES
The coordinate space to use.
consideringRulerUnitsboolIf true then a ruler location is interpreted using ruler units rather than points. The default value is false. This parameter has no effect unless the reference point is specified relative to a page. (Optional) (default: false)

string toSource ()
Generates a string which, if executed, will return the Graphic.

string toSpecifier ()
Retrieves the object specifier.

void transform (in: CoordinateSpaces, from: any, withMatrix: any[, replacingCurrent: any][, consideringRulerUnits: bool=false])
Transform the page item.

ParameterTypeDescription
inCoordinateSpaces:
CoordinateSpaces.PASTEBOARD_COORDINATES
CoordinateSpaces.PARENT_COORDINATES
CoordinateSpaces.INNER_COORDINATES
CoordinateSpaces.SPREAD_COORDINATES
The coordinate space to use
fromAnchorPoint
AnchorPoint
Array of 2 Reals
Array of Arrays of 2 Reals
BoundingBoxLimits
CoordinateSpaces
Long Integers
The temporary origin during the transformation. Can accept: Array of 2 Reals, AnchorPoint enumerator or Array of Arrays of 2 Reals, CoordinateSpaces enumerators, AnchorPoint enumerators, BoundingBoxLimits enumerators or Long Integers.
withMatrixArray of 6 Reals
TransformationMatrix
Transform matrix. Can accept: Array of 6 Reals or TransformationMatrix.
replacingCurrentArray of MatrixContent
Long Integer
MatrixContent
Transform components to consider; providing this optional parameter causes the target's existing transform components to be replaced with new values. Without this parameter, the given matrix is concatenated onto the target's existing transform combining the effect of the two. Can accept: MatrixContent enumerator, Array of MatrixContent enumerators or Long Integer. (Optional)
consideringRulerUnitsboolIf true then a ruler based origin is interpreted using ruler units rather than points. The default value is false. This parameter has no effect unless the reference point is specified relative to a page. (Optional) (default: false)

Array of string transformAgain ()
Transforms the Graphic using the last transformation performed on any object. Transformations include moving, rotating, shearing, scaling, and flipping.

Array of string transformAgainIndividually ()
Transforms the Graphic using the last transformation performed on any Graphic. Transformations include moving, rotating, shearing, scaling, and flipping.

Array of string transformSequenceAgain ()
Transforms the Graphic using the last sequence of transform operations performed on any single object or performed at the same time on any group of objects. Transformations include moving, rotating, shearing, scaling, and flipping.

Array of string transformSequenceAgainIndividually ()
Transforms the Graphic using the last sequence of transformations performed on any single object or performed at the same time on any group of objects. Transformations include moving, rotating, shearing, scaling, and flipping.

Array of TransformationMatrix transformValuesOf (in: CoordinateSpaces)
Get the transformation values of the page item.

ParameterTypeDescription
inCoordinateSpaces:
CoordinateSpaces.PASTEBOARD_COORDINATES
CoordinateSpaces.PARENT_COORDINATES
CoordinateSpaces.INNER_COORDINATES
CoordinateSpaces.SPREAD_COORDINATES
The coordinate space to use

Element of

Button.allGraphics

Button.overriddenMasterPageItem

Cell.allGraphics

Character.allGraphics

Document.allGraphics

EPS.overriddenMasterPageItem

Footnote.allGraphics

FormField.allGraphics

FormField.overriddenMasterPageItem

Graphic.overriddenMasterPageItem

GraphicLine.allGraphics

GraphicLine.overriddenMasterPageItem

Group.allGraphics

Group.overriddenMasterPageItem

Guide.overriddenMasterPageItem

Image.overriddenMasterPageItem

ImportedPage.overriddenMasterPageItem

InsertionPoint.allGraphics

Layer.allGraphics

Line.allGraphics

Link.parent

MasterSpread.allGraphics

Movie.overriddenMasterPageItem

Oval.allGraphics

Oval.overriddenMasterPageItem

PDF.overriddenMasterPageItem

PICT.overriddenMasterPageItem

Page.allGraphics

PageItem.allGraphics

PageItem.overriddenMasterPageItem

Paragraph.allGraphics

Polygon.allGraphics

Polygon.overriddenMasterPageItem

Rectangle.allGraphics

Rectangle.overriddenMasterPageItem

Sound.overriddenMasterPageItem

Spread.allGraphics

Story.allGraphics

Table.allGraphics

Text.allGraphics

TextColumn.allGraphics

TextFrame.allGraphics

TextFrame.overriddenMasterPageItem

TextStyleRange.allGraphics

WMF.overriddenMasterPageItem

Word.allGraphics

XMLElement.xmlContent

XmlStory.allGraphics

Used in:

array of Graphic Graphics.itemByRange (from: any, to: any)

Graphic Graphics.nextItem (obj: Graphic)

Graphic Graphics.previousItem (obj: Graphic)

void XMLElement.markup (using: any)

void XMLElement.placeXML (using: any)

XMLElement XMLElements.add (markupTag: any[, xmlContent: any][, withProperties: Object])

Return

Array of Graphic Graphic.getElements ()

Graphic Graphics.[] (index: number)

Graphic Graphics.anyItem ()

Array of Graphic Graphics.everyItem ()

Graphic Graphics.firstItem ()

Graphic Graphics.item (index: any)

Graphic Graphics.itemByID (id: number)

Graphic Graphics.itemByName (name: string)

Array of Graphic Graphics.itemByRange (from: any, to: any)

Graphic Graphics.lastItem ()

Graphic Graphics.middleItem ()

Graphic Graphics.nextItem (obj: Graphic)

Graphic Graphics.previousItem (obj: Graphic)

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