TemplateOptions

AMD: require(["esri/widgets/Print/TemplateOptions"], (TemplateOptions) => { /* code goes here */ });
ESM: import TemplateOptions from "@arcgis/core/widgets/Print/TemplateOptions.js";
Class: esri/widgets/Print/TemplateOptions
Inheritance: TemplateOptions→Accessor
Since: ArcGIS Maps SDK for JavaScript 4.6

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

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

Constructors

TemplateOptions

Constructor
new TemplateOptions(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 Watch for changes topic.
Show inherited properties Hide inherited properties
Name Type Summary Class

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

TemplateOptions

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

TemplateOptions

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

TemplateOptions

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

TemplateOptions

The name of the class.

Accessor

Resolution in dots per inch.

TemplateOptions

This property only applies when the layout value is map-only.

TemplateOptions

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

TemplateOptions

The output format for the printed map.

TemplateOptions

Map height.

TemplateOptions

When true, tables will be included in the printout request.

TemplateOptions

The layout used for the print output.

TemplateOptions

A custom layout hosted as a portal item.

TemplateOptions

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

TemplateOptions

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

TemplateOptions

The map scale of the printed map.

TemplateOptions

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

TemplateOptions

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

TemplateOptions

Map width.

TemplateOptions

Property Details

attributionEnabled

Property
attributionEnabled 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
author String

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

Property
copyright String

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

customTextElements

Property
customTextElements Object[]
Since: ArcGIS Maps SDK for JavaScript 4.22 TemplateOptions since 4.6, customTextElements added at 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

Inherited
Property
declaredClass Stringreadonly
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.7 Accessor since 4.0, declaredClass added at 4.7.

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

dpi

Property
dpi String

Resolution in dots per inch.

Default Value:96

fileName

Property
fileName String
Since: ArcGIS Maps SDK for JavaScript 4.14 TemplateOptions since 4.6, fileName added at 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
forceFeatureAttributes Boolean
Since: ArcGIS Maps SDK for JavaScript 4.8 TemplateOptions since 4.6, forceFeatureAttributes added at 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

format

Property
format String

The output format for the printed map.

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

Default Value:"pdf"

height

Property
height Number

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

includeTables

Property
includeTables Boolean
Since: ArcGIS Maps SDK for JavaScript 4.28 TemplateOptions since 4.6, includeTables added at 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.

Default Value:true
See also

layout

Property
layout String

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:

Value Description
map-only Map does not contain any layout elements. Only map image is printed.
a3-landscape A3 Landscape
a3-portrait A3 Portrait
a4-landscape A4 Landscape
a4-portrait A4 Portrait
letter-ansi-a-landscape Letter ANSI A Landscape
letter-ansi-a-portrait Letter ANSI A Portrait
tabloid-ansi-b-landscape Tabloid ANSI B Landscape
tabloid-ansi-b-portrait Tabloid ANSI B Portrait

Possible Values:"map-only" |"a3-landscape" |"a3-portrait" |"a4-landscape" |"a4-portrait" |"letter-ansi-a-landscape" |"letter-ansi-a-portrait" |"tabloid-ansi-b-landscape" |"tabloid-ansi-b-portrait"

Default Value:"letter-ansi-a-landscape"

layoutItem

Property
layoutItem PortalItem
Since: ArcGIS Maps SDK for JavaScript 4.29 TemplateOptions since 4.6, layoutItem added at 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.

legendEnabled

Property
legendEnabled Boolean

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

Default Value:true

northArrowEnabled

Property
northArrowEnabled Boolean

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

Default Value:false

scale

Property
scale Number

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

scaleEnabled

Property
scaleEnabled 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

title

Property
title String

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
width Number

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

Method Overview

Show inherited methods Hide inherited methods
Name Return Type Summary Class

Adds one or more handles which are to be tied to the lifecycle of the object.

Accessor

Returns true if a named group of handles exist.

Accessor

Removes a group of handles owned by the object.

Accessor

Method Details

addHandles

Inherited
Method
addHandles(handleOrHandles, groupKey)
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, addHandles added at 4.25.

Adds one or more handles which are to be tied to the lifecycle of the object. The handles will be removed when the object is destroyed.

// Manually manage handles
const handle = reactiveUtils.when(
  () => !view.updating,
  () => {
    wkidSelect.disabled = false;
  },
  { once: true }
);

this.addHandles(handle);

// Destroy the object
this.destroy();
Parameters
handleOrHandles WatchHandle|WatchHandle[]

Handles marked for removal once the object is destroyed.

groupKey *
optional

Key identifying the group to which the handles should be added. All the handles in the group can later be removed with Accessor.removeHandles(). If no key is provided the handles are added to a default group.

hasHandles

Inherited
Method
hasHandles(groupKey){Boolean}
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, hasHandles added at 4.25.

Returns true if a named group of handles exist.

Parameter
groupKey *
optional

A group key.

Returns
Type Description
Boolean Returns true if a named group of handles exist.
Example
// Remove a named group of handles if they exist.
if (obj.hasHandles("watch-view-updates")) {
  obj.removeHandles("watch-view-updates");
}

removeHandles

Inherited
Method
removeHandles(groupKey)
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, removeHandles added at 4.25.

Removes a group of handles owned by the object.

Parameter
groupKey *
optional

A group key or an array or collection of group keys to remove.

Example
obj.removeHandles(); // removes handles from default group

obj.removeHandles("handle-group");
obj.removeHandles("other-handle-group");

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.