PhotoshopCC 2015.5
Object

Document

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

Properties

NameType AccessDescription
Channel[] read/write The selected channels.
HistoryState read/write The history state to use with the history brush.
HistoryState read/write The current history state for this document.
Layer read/write The selected layer.
ArtLayers<ArtLayer> readonly The art layers collection in the document.
ArtLayer readonly The background layer for the document.
BitsPerChannelType
read/write The number of bits per channel.
Channels<Channel> readonly The channels collection in this document.
String read/write The name of the color profile. Valid only when no value is specified for color profile kind (to indicate a custom color profile).
ColorProfileType
read/write The type of color model that defines the working space of the document.
ColorSamplers<ColorSampler> readonly The current color samplers associated with the document.
Channel[] readonly The color component channels for this document.
CountItems<CountItem> readonly The current count items in the document.
File readonly The full path name of the document.
Guides<Guide> readonly The guides in this document.
UnitValue readonly The height of the document.
Int[] readonly A histogram showing the number of pixels at each color intensity level for the composite channel.
HistoryStates<HistoryState> readonly The history states collection in this document.
Int readonly The unique ID of this document.
DocumentInfo readonly Metadata about the document.
LayerComps<LayerComp> readonly The layer comps collection in this document.
LayerSets<LayerSet> readonly The layer sets collection in the document.
Layers<Layer> readonly The layers collection in the document.
Boolean readonly If true, the document is a workgroup document.
MeasurementScale readonly The measurement scale of the document.
DocumentMode
readonly The color profile.
String readonly The document name.
The readonly The object's container.
File readonly The path to the document.
PathItems<PathItem> readonly The path items collection in this document.
Number read/write The (custom) pixel aspect ratio of the document. Range: 0.100 to 10.000.
DocumentPrintSettings readonly Document print settings.
Boolean read/write If true, the document is in Quick Mask mode.
Number readonly The resolution of the document (in pixels per inch)
Boolean readonly If true, the document been saved since the last change.
Selection readonly The selected area of the document.
String readonly The class name of the object.
UnitValue readonly The width of the document.
XMPMetadata readonly The XMP properties of the document. The Camera RAW settings are stored here.

Methods

void

Counts the objects in the document.

channel Channel The channel to use for counting.
threshold Int 0–255 Threshold to use for counting. Range: 0 to 255.
void

Changes the mode of the document.

destinationMode ChangeMode The mode to change to.
options? DocumentConversionOptions Options for changing the mode.
void

Closes the document.

saving? SaveOptionsType Specifies whether changes should be saved before closing.
void

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

destinationProfile 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 The conversion intent.
blackPointCompensation? Boolean If true, black point compensation is used.
dither? Boolean If true, dither is used.
void

Crops the document.

bounds UnitRect The area to crop.
angle? Number The angle of cropping bounds.
width? UnitValue The width of the resulting document.
height? UnitValue The height of the resulting document.
Document

Creates a duplicate of the document object.

name? String The name of the new document.
mergeLayersOnly? Boolean If ture, duplicates merged layers only.
void

Exports the document.

exportIn File The file to export to.
exportAs? ExportType The type of export.
options? ExportOptions Options for the specified export type.
void

Flattens all layers.

void

Flips the canvas horizontally or vertically.

direction Direction The direction in which to flip the canvas.
void

Imports annotations into the document.

file File The document to import annotations from.
void

Flattens all visible layers in the document.

ArtLayer

Pastes contents of the clipboard into the document.

intoSelection? Boolean If true, contents are pasted into the current selection.
void

Prints the document.

sourceSpace? SourceSpaceType The color space for the source.
printSpace? 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 The color conversion intent.
blackPointCompensation? Boolean If true, black point compensation is used.
void

Print one copy of the document.

void

Rasterizes all layers.

void

Records the measurements of document.

source? MeasurementSource The source of the measurements to record.
dataPoints? String[] An array of identifiers of data points to record. Any data points not appropriate for the specified source are ignored.
void

Changes the size of the canvas.

width? UnitValue The desired width of the canvas.
height? UnitValue The desired height of the canvas.
anchor? AnchorPosition The anchor point to resize around.
void

Changes the size of the image.

width? UnitValue The desired width of the image.
height? UnitValue The desired height of the image.
resolution? Number The resolution (in pixels per inch)
resampleMethod? ResampleMethod The downsample method.
amount? Int 0–100 Amount of noise value when using preserve details (range: 0 - 100)
void

Expands the document to show clipped sections.

void

Rotates the canvas.

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

Saves the document.

void

Saves the document with the specified save options.

saveIn 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? Varies Options for the specified file type.
asCopy? Boolean Saves the document as a copy, leaving the original open.
extensionType? MacExtensionType Appends the specified extension to the file name.
Document[]

Splits the channels of the document.

void

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

historyString String The string to use for the history state.
javaScriptString String A string of JavaScript code to execute during the suspension of history.
void

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

width Int The trap width in pixels.
void

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

type? TrimType The color or type of pixels to base the trim on.
top? Boolean If true, trims away the top of the document.
left? Boolean If true, trims away the left of the document.
bottom? Boolean If true, trims away the bottom of the document.
right? Boolean If true, trims away the right of the document.

Object of 1

Properties elsewhere that hold a Document.

Parameter of 1

Method parameters that accept a Document.

Return 7

Methods that return a Document.