TemplateOptions

AMD: require(["esri/widgets/Print/TemplateOptions"], (TemplateOptions) => { /* code goes here */ });
ESM: import TemplateOptions from "@arcgis/core/widgets/Print/TemplateOptions";
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 the print page.

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

Constructors

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 Working with Properties topic.
Show inherited properties Hide inherited properties
Name Type Summary Class
Boolean

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

more details
TemplateOptions
String

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

more details
TemplateOptions
String

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

more details
TemplateOptions
Object[]

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

more details
TemplateOptions
String

The name of the class.

more details
Accessor
String

Resolution in dots per inch.

more details
TemplateOptions
String

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

more details
TemplateOptions
Boolean

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

more details
TemplateOptions
String

The output format for the printed map.

more details
TemplateOptions
Number

Map height.

more details
TemplateOptions
String

The layout used for the print output.

more details
TemplateOptions
Boolean

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

more details
TemplateOptions
Boolean

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

more details
TemplateOptions
Number

The map scale of the printed map.

more details
TemplateOptions
Boolean

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

more details
TemplateOptions
String

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

more details
TemplateOptions
Number

Map width.

more details
TemplateOptions

Property Details

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 String

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

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

customTextElements Object[]
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 Stringreadonly inherited
Since: ArcGIS Maps SDK for JavaScript 4.7

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

dpi String

Resolution in dots per inch.

Default Value:96
fileName String
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 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. 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 String

The output format for the printed map.

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

Default Value:pdf
height Number

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

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
legendEnabled Boolean

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

Default Value:true
northArrowEnabled Boolean

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

Default Value:false
scale Number

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

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 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 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.

more details
Accessor
Boolean

Returns true if a named group of handles exist.

more details
Accessor

Removes a group of handles owned by the object.

more details
Accessor

Method Details

addHandles(handleOrHandles, groupKey)inherited
Since: ArcGIS Maps SDK for JavaScript 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 }
);

// Handle gets removed when the object is destroyed.
this.addHandles(handle);
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(groupKey){Boolean}inherited
Since: ArcGIS Maps SDK for JavaScript 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(groupKey)inherited
Since: ArcGIS Maps SDK for JavaScript 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.