Skip to content
import TemplateOptions from "@arcgis/core/widgets/Print/TemplateOptions.js";
Inheritance:
TemplateOptionsAccessor
Since
ArcGIS Maps SDK for JavaScript 4.6

Defines the layout template options used by the Print widget and Print component to generate printed output.

See also
Example
const templateOptions = new TemplateOptions({
title: "My Print",
author: "Sam",
copyright: "My Company",
legendEnabled: false
});

Constructors

Constructor

Constructor
Parameters
ParameterTypeDescriptionRequired
properties
See the properties table for a list of all the properties that may be passed into the constructor.

Properties

Any properties can be set, retrieved or listened to. See the Watch for changes topic.

attributionEnabled

Property
Type
boolean

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

author

Property
Type
string | null | undefined

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

Property
Type
string | null | undefined

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

customTextElements

Property
Type
Record<string, string>[] | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.22

Use this prop to display text fields for custom text elements from the print service.

Note that these options are listed under the Advanced Options panel

declaredClass

readonlyinherited Property
Type
string
Inherited from: Accessor
Since
ArcGIS Maps SDK for JavaScript 4.7

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

dpi

Property
Type
number

Resolution in dots per inch.

Default value
96

dynamicLegendEnabled

Property
Type
boolean | null | undefined

When true, the dynamic legend will be included on the printout.

fileName

Property
Type
string | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.14

This property only applies when the layout value is map-only. If the layout value is not map-only, see title.

If the application and the print service are on the same origin, this property defines the file name of the downloadable printed map, and the title of the map in the printout. Clicking on the download icon or the file name will download the printed map.

Download-Link

If the application and the print service are not on the same origin, this property defines the title of the map in the printout. The file name of the downloadable printed map will be generated by the ArcGIS Enterprise that hosts the print service. Clicking on the external link icon or the file name will open the printed map in a new window.

External-Link

forceFeatureAttributes

Property
Type
boolean
Since
ArcGIS Maps SDK 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.

Default value
false

format

Property
Type
PrintFileFormat

The output format for the printed map.

Default value
"pdf"

height

Property
Type
number | null | undefined

Map height. This only applies when the layout value is map-only.

id

readonly Property
Type
string | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.33

Unique id of the template.

includeTables

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 4.28

When true, tables will be included in the printout request. A table is a non-spatial dataset in a feature service or map service.

Note that for the table to display in the printout, the print template must be configured to support tables.

See also
Default value
true

layout

Property
Type
PrintLayoutTemplate | null | undefined

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: 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
"letter-ansi-a-landscape"

layoutItem

autocast Property
Type
PortalItem | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.29

A custom layout hosted as a portal item. To use this property, the print service must be hosted on an ArcGIS Server that is federated with the same portal as the portal item.

Known Limitations

This capability is only available with ArcGIS Enterprise 11.1 or later.

See also

legendEnabled

Property
Type
boolean | null | undefined

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

northArrowEnabled

Property
Type
boolean | null | undefined

When true, the north arrow will be included on the printout.

scale

Property
Type
number | null | undefined

The map scale of the printed map. Only applies when scaleEnabled is true.

scaleBarEnabled

Property
Type
boolean | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.33

When true, the scale bar will be included on the printout.

scaleBarUnit

Property
Type
"miles" | "kilometers" | "meters" | "feet" | null | undefined
Since
ArcGIS Maps SDK for JavaScript 5.0

The unit of measurement for the scale bar.

scaleEnabled

Property
Type
boolean

Define whether the printed map should preserve map scale or map extent. When true, scale is used in the printed map. When false, the current map extent is used in the printed map.

Default value
false

state

readonly Property
Type
"ready" | "pending" | "error"
Since
ArcGIS Maps SDK for JavaScript 4.33

The state of the template loading.

Default value
"ready"

title

Property
Type
string | null | undefined

The text used for the map title if the specified layout contains a title text element. This only applies if the layout value is not map-only. For map-only, see fileName.

If the application and the print service are on the same origin, this property defines the file name of the downloadable printed map, and the title of the map in the printout. Clicking on the download icon or the file name will download the printed map.

Download-Link

If the application and the print service are not on the same origin, this property defines the title of the map in the printout. The file name of the downloadable printed map will be generated by the ArcGIS Enterprise that hosts the print service. Clicking on the external link icon or the file name will open the printed map in a new window.

External-Link

width

Property
Type
number | null | undefined

Map width. This only applies when the layout value is map-only.