PrintTemplate

require(["esri/tasks/support/PrintTemplate"], function(PrintTemplate) { /* code goes here */ });
Class: esri/tasks/support/PrintTemplate
Inheritance: PrintTemplate Accessor
Since: ArcGIS API for JavaScript 4.1

Defines the layout template options used by the PrintTask to generate the print page.

Constructors

new PrintTemplate(properties)
Parameter:
properties Object
optional

See the properties for a list of all the properties that may be passed into the constructor.

Property Overview

Any properties can be set, retrieved or listened to. See the Working with Properties topic.
NameTypeSummaryClass
Boolean

When false, the attribution is not displayed on the printout.

more details
more detailsPrintTemplate
String

The name of the class.

more details
more detailsAccessor
Object

Define the map width, height and dpi.

more details
more detailsPrintTemplate
Boolean

When true, the feature's attributes are included in feature collection layers even when they are not needed for rendering.

more details
more detailsPrintTemplate
String

The output format for the printed map.

more details
more detailsPrintTemplate
String

The layout used for the print output.

more details
more detailsPrintTemplate
Object

Defines the layout elements.

more details
more detailsPrintTemplate
Number

The optional map scale of the printed map.

more details
more detailsPrintTemplate
Boolean

Define whether the printed map should preserve map scale or map extent.

more details
more detailsPrintTemplate
Boolean

When true, labels will be shown on the layout.

more details
more detailsPrintTemplate

Property Details

attributionVisibleBoolean

When false, the attribution is not displayed on the printout. This only applies when the layout value is map-only. Reference our policies on Licensing & Attribution for specific attribution requirements.

Default Value:true
declaredClassStringreadonly inherited
Since: ArcGIS API for JavaScript 4.7

The name of the class. The declared class name is formatted as esri.folder.className.

exportOptionsObject

Define the map width, height and dpi. Required when layout = 'map-only'. See the object specification table below for available options to set for exportOptions.

Properties:
width Number
optional

Map width. Default value is 800.

height Number
optional

Map height. Default value is 1100.

dpi Number
optional

Resolution in dots per inch. If modified when layout = 'map-only', the width and height will also need to be modified proportional to the dpi change. Default value is 96.

forceFeatureAttributesBoolean
Since: ArcGIS API for JavaScript 4.8

When true, the feature's attributes are included in feature collection layers even when they are not needed for rendering. By default they are removed to reduce the request size. Only applicable to custom print services which use the feature attributes, for example to display a table of features and their attributes.

Default Value:false
formatString

The output format for the printed map.

Possible Values: pdf | png32 | png8 | jpg | gif | eps | svg | svgz

Default Value:png32
layoutString

The layout used for the print output. When the value is map-only or is empty, the output map does not contain any page layout surroundings (for example, title, legend, scale bar and so forth). The print service provides out-of-the-box templates listed in possible values. The server administrator can add additional templates to the print service.

Possible values are listed below:

ValueDescription
map-onlyMap does not contain any layout elements. Only map image is printed.
a3-landscapeA3 Landscape
a3-portraitA3 Portrait
a4-landscapeA4 Landscape
a4-portraitA4 Portrait
letter-ansi-a-landscapeLetter ANSI A Landscape
letter-ansi-a-portraitLetter ANSI A Portrait
tabloid-ansi-b-landscapeTabloid ANSI B Landscape
tabloid-ansi-b-portraitTabloid ANSI B Portrait
Default Value:map-only
layoutOptionsObject

Defines the layout elements. It's an object with the following properties:

Properties:
titleText String

The text used for the map title if the specified layout contains a title text element.

authorText String

The text used for the author if the specified layout contains an author text element.

copyrightText String

The text used for the copyright if the specified layout contains an copyright text element.

scalebarUnit String
optional
Default Value:Miles

The unit used for the scalebar.

Possible Values: Miles | Kilometers | Meters | Feet

legendLayers LegendLayer[]

An array of LegendLayer containing the id's of the layers that will be included in the legend. If legendLayers is not specified, all operational layers (non-tiled layers) will be present in the legend. To specify that no layers will be included in the legend set legendLayer = [].

customTextElements Object[]

An array of name-value pairs. Use this property to update the text for custom text elements on the page layout. Values must be strings.

Example:
layoutOptions: {
  titleText: "My Print",
  authorText: "Sam",
  copyrightText: "My Company",
  scalebarUnit: "Miles",
  // the following text elements must
  // exist in your print service
  customTextElements: [{
     "description": "My description",
     "location": "My Location"
  }]
}
outScaleNumber

The optional map scale of the printed map. Only applies when preserveScale = true. If outScale is less than 1, then the printed map will use the scale of the input map.

Default Value:0
preserveScaleBoolean

Define whether the printed map should preserve map scale or map extent. If true, the printed map will use the outScale property or default to the scale of the input map. If false, the printed map will use the same extent as the input map and thus scale might change.

Default Value:true
showLabelsBoolean

When true, labels will be shown on the layout.

Default Value:true

API Reference search results

NameTypeModule
Loading...