require(["esri/widgets/Print/TemplateOptions"], (TemplateOptions) => { /* code goes here */ });
import TemplateOptions from "@arcgis/core/widgets/Print/TemplateOptions.js";
esri/widgets/Print/TemplateOptions
Defines the layout template options used by the Print widget to generate printed output.
- See also
const templateOptions = new TemplateOptions({
title: "My Print",
author: "Sam",
copyright: "My Company",
legendEnabled: false
});
Constructors
-
Parameterproperties Objectoptional
See the properties for a list of all the properties that may be passed into the constructor.
Property Overview
Name | Type | Summary | Class |
---|---|---|---|
When | 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 | 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 | TemplateOptions | ||
The layout used for the print output. | TemplateOptions | ||
A custom layout hosted as a portal item. | TemplateOptions | ||
When | TemplateOptions | ||
When | 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
attributionEnabled Boolean
-
When
false
, the attribution is not displayed on the printout. This only applies when the layout value ismap-only
. Reference our policies on Licensing & Attribution for specific attribution requirements.- Default Value:true
-
author
author String
-
The text used for the author if the specified layout contains an author text element.
-
copyright
copyright String
-
The text used for the copyright if the specified layout contains an copyright text element.
-
Since: ArcGIS Maps SDK for JavaScript 4.22TemplateOptions 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
-
dpi
dpi String
-
Resolution in dots per inch.
- Default Value:96
-
fileName
fileName String
Since: ArcGIS Maps SDK for JavaScript 4.14TemplateOptions since 4.6, fileName added at 4.14. -
This property only applies when the layout value is
map-only
. If the layout value is notmap-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.
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.
-
forceFeatureAttributes
forceFeatureAttributes Boolean
Since: ArcGIS Maps SDK for JavaScript 4.8TemplateOptions 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
format String
-
The output format for the printed map.
Possible Values:"pdf" |"png32" |"png8" |"jpg" |"gif" |"eps" |"svg" |"svgz"
- Default Value:"pdf"
-
includeTables
includeTables Boolean
Since: ArcGIS Maps SDK for JavaScript 4.28TemplateOptions 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
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
layoutItem PortalItem
Since: ArcGIS Maps SDK for JavaScript 4.29TemplateOptions 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
legendEnabled Boolean
-
When
false
, the legend is not displayed on the printout.- Default Value:true
-
northArrowEnabled
northArrowEnabled Boolean
-
When
true
, the north arrow will be included on the printout.- Default Value:false
-
scale
scale Number
-
The map scale of the printed map. Only applies when scaleEnabled is
true
.
-
title
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
. Formap-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.
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.
Method Overview
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
-
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25Accessor 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();
ParametershandleOrHandles WatchHandle|WatchHandle[]Handles marked for removal once the object is destroyed.
groupKey *optionalKey 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
InheritedMethodhasHandles(groupKey){Boolean}
Inherited from AccessorSince: ArcGIS Maps SDK for JavaScript 4.25Accessor since 4.0, hasHandles added at 4.25. -
Returns true if a named group of handles exist.
ParametergroupKey *optionalA group key.
ReturnsType 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"); }
-
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25Accessor since 4.0, removeHandles added at 4.25. -
Removes a group of handles owned by the object.
ParametergroupKey *optionalA group key or an array or collection of group keys to remove.
Exampleobj.removeHandles(); // removes handles from default group obj.removeHandles("handle-group"); obj.removeHandles("other-handle-group");