Packagecom.adobe.photoshop
Classpublic class Document
InheritanceDocument Inheritance PhotoshopHostObject Inheritance CSHostObject Inheritance flash.utils.Proxy

The active containment object for the layers and all other objects in the script; the basic canvas for the file.



Public Properties
 PropertyDefined By
  activeChannels : Array
The selected channels.
Document
  activeHistoryBrushSource : HistoryState
The history state to use with the history brush.
Document
  activeHistoryState : HistoryState
The current history state for this document.
Document
  activeLayer : Layer
The selected layer.
Document
  artLayers : ArtLayers
[read-only] The art layers collection in the document.
Document
  backgroundLayer : ArtLayer
[read-only] The background layer for the document.
Document
  bitsPerChannel : BitsPerChannelType
The number of bits per channel.
Document
  channels : Channels
[read-only] The channels collection in this document.
Document
  colorProfileName : String
The name of the color profile.
Document
  colorProfileType : ColorProfile
Type of color profile management for document.
Document
  colorSamplers : ColorSamplers
[read-only] The current color samplers associated with the document.
Document
  componentChannels : Array
[read-only] The color component channels for this document.
Document
  countItems : CountItems
[read-only] The current count items in the document.
Document
  fullName : File
[read-only] The full path name of the document.
Document
  guides : Guides
[read-only] the guides in this document
Document
  height : String
[read-only] The height of the document.
Document
  histogram : Array
[read-only] A histogram showing the number of pixels at each color intensity level for the composite channel.
Document
  historyStates : HistoryStates
[read-only] The history states collection in this document.
Document
 InheritedhostObjectDelegate : HostObject
Getter for the delegate
CSHostObject
  info : DocumentInfo
[read-only] Metadata about the document.
Document
  layerComps : LayerComps
[read-only] The layer comps collection in this document.
Document
  layers : Layers
[read-only] The layers collection in the document.
Document
  layerSets : LayerSets
[read-only] The layer sets collection in the document.
Document
  managed : Boolean
[read-only] If true, the document is a workgroup document.
Document
  measurementScale : MeasurementScale
[read-only] The measurement scale of the document.
Document
  mode : DocumentMode
[read-only] The color profile.
Document
  name : String
[read-only] The document name.
Document
 Inheritedparent : *
[read-only]
PhotoshopHostObject
  path : File
[read-only] The path to the document.
Document
  pathItems : PathItems
[read-only] The path items collection in this document.
Document
  pixelAspectRatio : Number
The (custom) pixel aspect ratio of the document.
Document
  printSettings : DocumentPrintSettings
[read-only] Document print settings.
Document
  quickMaskMode : Boolean
If true, the document is in Quick Mask mode.
Document
  resolution : Number
[read-only] The resolution of the document (in pixels per inch)
Document
  saved : Boolean
[read-only] If true, the document been saved since the last change.
Document
  selection : Selection
[read-only] The selected area of the document.
Document
  width : String
[read-only] The width of the document.
Document
  xmpMetadata : XmpMetadata
[read-only] The XMP properties of the document.
Document
Public Methods
 MethodDefined By
  
autoCount(channel:Channel, threshold:Number):void
Counts the objects in the document.
Document
  
changeMode(destinationMode:ChangeMode, options:DocumentConversionOptions = null):void
Changes the mode of the document.
Document
  
close(saving:SaveOptions = null):void
Closes the document.
Document
  
convertProfile(destinationProfile:String, intent:Intent, blackPointCompensation:Boolean, dither:Boolean = true):void
Converts the document from using one color profile to using another.
Document
  
crop(bounds:Array, angle:Number = 0, width:String = null, height:String = null):void
Crops the document.
Document
  
duplicate(name:String = null, mergeLayersOnly:Boolean):Document
Duplicate this object.
Document
  
exportDocument(exportIn:File, exportAs:ExportType = null, options:ExportOptions = null):void
Exports the document.
Document
 Inherited
filterArgsForHBAPI(args:Array):Array
[static] Function to clean up the argument list and put it into a format that makes sense for HBAPI.
CSHostObject
 Inherited
filterSingleObjectForHBAPI(value:Object):Object
[static]
CSHostObject
  
flatten():void
Flattens all layers.
Document
  
flipCanvas(direction:Direction):void
Flips the canvas horizontally or vertically.
Document
 Inherited
getClassObjectForName(className:String):HostObject
[static] This returns a "Class" object, meaning, a HostObject that can be used to make static function calls or get static properties
CSHostObject
 Inherited
getSpecialTranslation(className:String, ho:HostObject, expectedReturnType:Class, ownerName:String):*
[static]
CSHostObject
 Inherited
hostCall(name:String, expectedReturnType:Class, rawargs:Array):*
Encapsulates a function call to the host
CSHostObject
 Inherited
hostCallStatic(className:String, methodName:String, expectedReturnType:Class, rawargs:Array):*
[static] Implements a safe call of a static method on the host
CSHostObject
 Inherited
hostGet(name:String, expectedReturnType:Class):*
Encapsulates a property get to the host
CSHostObject
 Inherited
hostGetIndex(idx:Object, expectedReturnType:Class):*
Encapsulates a indexed get to the host
CSHostObject
 Inherited
hostGetStatic(className:String, propertyName:String, expectedReturnType:Class):*
[static] Implements a safe get of a static property on the host Used by for instance, all the enum implementations.
CSHostObject
 Inherited
hostSet(name:String, rawvalue:*):void
Encapsulates a property set to the host
CSHostObject
 Inherited
hostSetStatic(className:String, propertyName:String, rawvalue:*):*
[static] Implements a safe set of a static property on the host
CSHostObject
  
importAnnotations(file:File):void
Imports annotations into the document.
Document
 Inherited
isDescendedFrom(clz:Class, ancClass:Class):Boolean
[static] Efficiently determines whether or not one class descends from another in inheritance hierarchy- class relationships are cached by the ClassUtils implementation- (uses org.as3commons lib to quickly discover class hierarchy.
CSHostObject
  
Flattens all visible layers in the document.
Document
  
paste(intoSelection:Boolean = false):ArtLayer
Pastes contents of the clipboard into the document.
Document
  
print(sourceSpace:SourceSpaceType = null, printSpace:String = null, intent:Intent = null, blackPointCompensation:Boolean = true):void
Prints the document.
Document
  
Print one copy of the document.
Document
  
Rasterizes all layers.
Document
  
recordMeasurements(source:MeasurementSource = null, dataPoints:Object = null):void
Records the measurements of document.
Document
 Inherited
replaceDefaultArgs(args:Array, defaultArgs:Array):Array
Function to tidy up arguments prior to call.
CSHostObject
  
resizeCanvas(width:String = null, height:String = null, anchor:AnchorPosition = null):void
Changes the size of the canvas.
Document
  
resizeImage(width:String = null, height:String = null, resolution:Number, resampleMethod:ResampleMethod = null):void
Changes the size of the image.
Document
  
revealAll():void
Expands the document to show clipped sections.
Document
  
rotateCanvas(angle:Number):void
Rotates the canvas.
Document
  
save():void
Saves the document.
Document
  
saveAs(saveIn:File, options:Object = null, asCopy:Boolean, extensionType:Extension = null):void
Saves the document with the specified save options.
Document
  
splitChannels():Object
Splits the channels of the document.
Document
  
suspendHistory(historyString:String, javaScriptString:String):void
Provides a single history state for the entire script.
Document
  
trap(width:Number):void
Applies trapping to a CMYK document.
Document
  
trim(type:TrimType = null, top:Boolean = true, left:Boolean = true, bottom:Boolean = true, right:Boolean = true):void
Trims the transparent area around the image on the specified sides of the canvas.
Document
 Inherited
wrapReturnedHostObject(rawObject:Object, expectedReturnType:Class, client:CSHostObject, propertyName:String):*
[static] Method used on static/normal get/ hostcalls
CSHostObject
Protected Methods
 MethodDefined By
 Inherited
createWithArgs(args:Array):void
CSHostObject
 Inherited
hostCreate(args:Array):void
CSHostObject
Property Detail
activeChannelsproperty
activeChannels:Array

The selected channels.


Implementation
    public function get activeChannels():Array
    public function set activeChannels(value:Array):void
activeHistoryBrushSourceproperty 
activeHistoryBrushSource:HistoryState

The history state to use with the history brush.


Implementation
    public function get activeHistoryBrushSource():HistoryState
    public function set activeHistoryBrushSource(value:HistoryState):void
activeHistoryStateproperty 
activeHistoryState:HistoryState

The current history state for this document.


Implementation
    public function get activeHistoryState():HistoryState
    public function set activeHistoryState(value:HistoryState):void
activeLayerproperty 
activeLayer:Layer

The selected layer.


Implementation
    public function get activeLayer():Layer
    public function set activeLayer(value:Layer):void
artLayersproperty 
artLayers:ArtLayers  [read-only]

The art layers collection in the document.


Implementation
    public function get artLayers():ArtLayers
backgroundLayerproperty 
backgroundLayer:ArtLayer  [read-only]

The background layer for the document.


Implementation
    public function get backgroundLayer():ArtLayer
bitsPerChannelproperty 
bitsPerChannel:BitsPerChannelType

The number of bits per channel.


Implementation
    public function get bitsPerChannel():BitsPerChannelType
    public function set bitsPerChannel(value:BitsPerChannelType):void
channelsproperty 
channels:Channels  [read-only]

The channels collection in this document.


Implementation
    public function get channels():Channels
colorProfileNameproperty 
colorProfileName:String

The name of the color profile. Valid only when no value is specified for color profile kind (to indicate a custom color profile).


Implementation
    public function get colorProfileName():String
    public function set colorProfileName(value:String):void
colorProfileTypeproperty 
colorProfileType:ColorProfile

Type of color profile management for document. Note: If you want to set a custom color profile, do not set a value for color profile kind; rather, set the appropriate color profile name.


Implementation
    public function get colorProfileType():ColorProfile
    public function set colorProfileType(value:ColorProfile):void
colorSamplersproperty 
colorSamplers:ColorSamplers  [read-only]

The current color samplers associated with the document.


Implementation
    public function get colorSamplers():ColorSamplers
componentChannelsproperty 
componentChannels:Array  [read-only]

The color component channels for this document.


Implementation
    public function get componentChannels():Array
countItemsproperty 
countItems:CountItems  [read-only]

The current count items in the document.


Implementation
    public function get countItems():CountItems
fullNameproperty 
fullName:File  [read-only]

The full path name of the document.


Implementation
    public function get fullName():File
guidesproperty 
guides:Guides  [read-only]

the guides in this document


Implementation
    public function get guides():Guides
heightproperty 
height:String  [read-only]

The height of the document.


Implementation
    public function get height():String
histogramproperty 
histogram:Array  [read-only]

A histogram showing the number of pixels at each color intensity level for the composite channel. Valid only when 'mode' = RGB, CMYK, or indexed.


Implementation
    public function get histogram():Array
historyStatesproperty 
historyStates:HistoryStates  [read-only]

The history states collection in this document.


Implementation
    public function get historyStates():HistoryStates
infoproperty 
info:DocumentInfo  [read-only]

Metadata about the document.


Implementation
    public function get info():DocumentInfo
layerCompsproperty 
layerComps:LayerComps  [read-only]

The layer comps collection in this document.


Implementation
    public function get layerComps():LayerComps
layersproperty 
layers:Layers  [read-only]

The layers collection in the document.


Implementation
    public function get layers():Layers
layerSetsproperty 
layerSets:LayerSets  [read-only]

The layer sets collection in the document.


Implementation
    public function get layerSets():LayerSets
managedproperty 
managed:Boolean  [read-only]

If true, the document is a workgroup document.


Implementation
    public function get managed():Boolean
measurementScaleproperty 
measurementScale:MeasurementScale  [read-only]

The measurement scale of the document.


Implementation
    public function get measurementScale():MeasurementScale
modeproperty 
mode:DocumentMode  [read-only]

The color profile.


Implementation
    public function get mode():DocumentMode
nameproperty 
name:String  [read-only]

The document name.


Implementation
    public function get name():String
pathproperty 
path:File  [read-only]

The path to the document.


Implementation
    public function get path():File
pathItemsproperty 
pathItems:PathItems  [read-only]

The path items collection in this document.


Implementation
    public function get pathItems():PathItems
pixelAspectRatioproperty 
pixelAspectRatio:Number

The (custom) pixel aspect ratio of the document. Range: 0.100 to 10.000.


Implementation
    public function get pixelAspectRatio():Number
    public function set pixelAspectRatio(value:Number):void
printSettingsproperty 
printSettings:DocumentPrintSettings  [read-only]

Document print settings.


Implementation
    public function get printSettings():DocumentPrintSettings
quickMaskModeproperty 
quickMaskMode:Boolean

If true, the document is in Quick Mask mode.


Implementation
    public function get quickMaskMode():Boolean
    public function set quickMaskMode(value:Boolean):void
resolutionproperty 
resolution:Number  [read-only]

The resolution of the document (in pixels per inch)


Implementation
    public function get resolution():Number
savedproperty 
saved:Boolean  [read-only]

If true, the document been saved since the last change.


Implementation
    public function get saved():Boolean
selectionproperty 
selection:Selection  [read-only]

The selected area of the document.


Implementation
    public function get selection():Selection
widthproperty 
width:String  [read-only]

The width of the document.


Implementation
    public function get width():String
xmpMetadataproperty 
xmpMetadata:XmpMetadata  [read-only]

The XMP properties of the document. The Camera RAW settings are stored here.


Implementation
    public function get xmpMetadata():XmpMetadata
Method Detail
autoCount()method
public function autoCount(channel:Channel, threshold:Number):void

Counts the objects in the document.

Parameters

channel:Channel — (com.adobe.photoshop.Channel) The channel to use for counting.
 
threshold:Number — (Number) Threshold to use for counting. Range: 0 to 255. ( 0 - 255 )

changeMode()method 
public function changeMode(destinationMode:ChangeMode, options:DocumentConversionOptions = null):void

Changes the mode of the document.

Parameters

destinationMode:ChangeMode — (com.adobe.photoshop.ChangeMode) The mode to change to.
 
options:DocumentConversionOptions (default = null) — (com.adobe.photoshop.DocumentConversionOptions) Options for changing the mode.

close()method 
public function close(saving:SaveOptions = null):void

Closes the document.

Parameters

saving:SaveOptions (default = null) — (com.adobe.photoshop.SaveOptions) Specifies whether changes should be saved before closing. ( default: SaveOptions.PROMPTTOSAVECHANGES )

convertProfile()method 
public function convertProfile(destinationProfile:String, intent:Intent, blackPointCompensation:Boolean, dither:Boolean = true):void

Converts the document from using one color profile to using another.

Parameters

destinationProfile:String — (String) The color profile to convert to. Either a string specifying a color profile, one of the working color spaces, or Lab color.
 
intent:Intent — (com.adobe.photoshop.Intent) The conversion intent.
 
blackPointCompensation:Boolean (default = NaN) — (Boolean) If true, black point compensation is used.
 
dither:Boolean (default = true) — (Boolean) If true, dither is used. ( default: true )

crop()method 
public function crop(bounds:Array, angle:Number = 0, width:String = null, height:String = null):void

Crops the document.

Parameters

bounds:Array — (Array) The area to crop.
 
angle:Number (default = 0) — (Number) The angle of cropping bounds. ( default: 0.0 )
 
width:String (default = null) — (String) The width of the resulting document.
 
height:String (default = null) — (String) The height of the resulting document.

duplicate()method 
public function duplicate(name:String = null, mergeLayersOnly:Boolean):Document

Duplicate this object.

Parameters

name:String (default = null) — (String) The name of the new document.
 
mergeLayersOnly:Boolean (default = NaN) — (Boolean) If ture, duplicates merged layers only.

Returns
Document
exportDocument()method 
public function exportDocument(exportIn:File, exportAs:ExportType = null, options:ExportOptions = null):void

Exports the document.

Parameters

exportIn:File — (flash.filesystem.File) The file to export to.
 
exportAs:ExportType (default = null) — (com.adobe.photoshop.ExportType) The type of export. ( default: ExportType.ILLUSTRATORPATHS )
 
options:ExportOptions (default = null) — (com.adobe.photoshop.ExportOptions) Options for the specified export type.

flatten()method 
public function flatten():void

Flattens all layers.

flipCanvas()method 
public function flipCanvas(direction:Direction):void

Flips the canvas horizontally or vertically.

Parameters

direction:Direction — (com.adobe.photoshop.Direction) The direction in which to flip the canvas.

importAnnotations()method 
public function importAnnotations(file:File):void

Imports annotations into the document.

Parameters

file:File — (flash.filesystem.File) The document to import annotations from.

mergeVisibleLayers()method 
public function mergeVisibleLayers():void

Flattens all visible layers in the document.

paste()method 
public function paste(intoSelection:Boolean = false):ArtLayer

Pastes contents of the clipboard into the document.

Parameters

intoSelection:Boolean (default = false) — (Boolean) If true, contents are pasted into the current selection. ( default: false )

Returns
ArtLayer
print()method 
public function print(sourceSpace:SourceSpaceType = null, printSpace:String = null, intent:Intent = null, blackPointCompensation:Boolean = true):void

Prints the document.

Parameters

sourceSpace:SourceSpaceType (default = null) — (com.adobe.photoshop.SourceSpaceType) The color space for the source. ( default: SourceSpaceType.DOCUMENT )
 
printSpace:String (default = null) — (String) The color space for the printer. Can be "nothing" (meaning same as source); one of the working spaces or Lab color; or a string specifying a color space. Default: nothing.
 
intent:Intent (default = null) — (com.adobe.photoshop.Intent) The color conversion intent. ( default: Intent.RELATIVECOLORIMETRIC )
 
blackPointCompensation:Boolean (default = true) — (Boolean) If true, black point compensation is used. ( default: true )

printOneCopy()method 
public function printOneCopy():void

Print one copy of the document.

rasterizeAllLayers()method 
public function rasterizeAllLayers():void

Rasterizes all layers.

recordMeasurements()method 
public function recordMeasurements(source:MeasurementSource = null, dataPoints:Object = null):void

Records the measurements of document.

Parameters

source:MeasurementSource (default = null) — (com.adobe.photoshop.MeasurementSource) The source of the measurements to record.
 
dataPoints:Object (default = null) — (Object) An array of identifiers of data points to record. Any data points not appropriate for the specified source are ignored.

resizeCanvas()method 
public function resizeCanvas(width:String = null, height:String = null, anchor:AnchorPosition = null):void

Changes the size of the canvas.

Parameters

width:String (default = null) — (String) The desired width of the canvas.
 
height:String (default = null) — (String) The desired height of the canvas.
 
anchor:AnchorPosition (default = null) — (com.adobe.photoshop.AnchorPosition) The anchor point to resize around. ( default: AnchorPosition.MIDDLECENTER )

resizeImage()method 
public function resizeImage(width:String = null, height:String = null, resolution:Number, resampleMethod:ResampleMethod = null):void

Changes the size of the image.

Parameters

width:String (default = null) — (String) The desired width of the image.
 
height:String (default = null) — (String) The desired height of the image.
 
resolution:Number (default = NaN) — (Number) The resolution (in pixels per inch)
 
resampleMethod:ResampleMethod (default = null) — (com.adobe.photoshop.ResampleMethod) The downsample method. ( default: ResampleMethod.BICUBIC )

revealAll()method 
public function revealAll():void

Expands the document to show clipped sections.

rotateCanvas()method 
public function rotateCanvas(angle:Number):void

Rotates the canvas.

Parameters

angle:Number — (Number) The number of degrees to rotate. A positive angle rotates the canvas clockwise; a negative value rotates the canvas counter-clockwise.

save()method 
public function save():void

Saves the document.

saveAs()method 
public function saveAs(saveIn:File, options:Object = null, asCopy:Boolean, extensionType:Extension = null):void

Saves the document with the specified save options.

Parameters

saveIn:File — (flash.filesystem.File) The file to save to, specified as a string containing the full file path or an alias. If not specified, the document is saved to its existing file.
 
options:Object (default = null) — (Object) Options for the specified file type.
 
asCopy:Boolean (default = NaN) — (Boolean) Saves the document as a copy, leaving the original open.
 
extensionType:Extension (default = null) — (com.adobe.photoshop.Extension) Appends the specified extension to the file name.

splitChannels()method 
public function splitChannels():Object

Splits the channels of the document.

Returns
Object
suspendHistory()method 
public function suspendHistory(historyString:String, javaScriptString:String):void

Provides a single history state for the entire script. Allows a single undo for all actions taken in the script.

Parameters

historyString:String — (String) The string to use for the history state.
 
javaScriptString:String — (String) A string of JavaScript code to execute during the suspension of history.

trap()method 
public function trap(width:Number):void

Applies trapping to a CMYK document. Valid only when 'mode' = CMYK.

Parameters

width:Number — (Number) The trap width in pixels.

trim()method 
public function trim(type:TrimType = null, top:Boolean = true, left:Boolean = true, bottom:Boolean = true, right:Boolean = true):void

Trims the transparent area around the image on the specified sides of the canvas.

Parameters

type:TrimType (default = null) — (com.adobe.photoshop.TrimType) The color or type of pixels to base the trim on. ( default: TrimType.TOPLEFT )
 
top:Boolean (default = true) — (Boolean) If true, trims away the top of the document. ( default: true )
 
left:Boolean (default = true) — (Boolean) If true, trims away the left of the document. ( default: true )
 
bottom:Boolean (default = true) — (Boolean) If true, trims away the bottom of the document. ( default: true )
 
right:Boolean (default = true) — (Boolean) If true, trims away the right of the document. ( default: true )