PrintTemplate
require(["esri/tasks/support/PrintTemplate"], function(PrintTemplate) { /* code goes here */ });esri/tasks/support/PrintTemplateDefines the layout template options used by the PrintTask to generate the print page.
Constructors
- new PrintTemplate(properties)
- Parameter:properties ObjectoptionalSee the properties for a list of all the properties that may be passed into the constructor. 
Property Overview
| Name | Type | Summary | Class | |
|---|---|---|---|---|
| Boolean | When  | more details | PrintTemplate | |
| String | The name of the class.more details | more details | Accessor | |
| Object | Define the map width, height and dpi.more details | more details | PrintTemplate | |
| Boolean | When true, the feature's attributes are included in feature collection layers even when they are not needed for rendering.more details | more details | PrintTemplate | |
| String | The output format for the printed map.more details | more details | PrintTemplate | |
| String | The layout used for the print output.more details | more details | PrintTemplate | |
| Object | Defines the layout elements.more details | more details | PrintTemplate | |
| Number | The optional map scale of the printed map.more details | more details | PrintTemplate | |
| Boolean | Define whether the printed map should preserve map scale or map extent.more details | more details | PrintTemplate | |
| Boolean | Define whether the printed map should preserve map scale or map extent.more details | more details | PrintTemplate | |
| Boolean | When  | more details | PrintTemplate | 
Property Details
- attributionVisible 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
 
- Since: ArcGIS API for JavaScript 4.7
- The name of the class. The declared class name is formatted as - esri.folder.className.
- exportOptions Object
- 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:
- optionalwidth NumberMap width. Default value is 800. If the dpivalue is modified, then thewidthandheightwill be modified proportional to thedpichange. If thewidthvalue is modified independently, thedpiandheightvalues will not be modified.optionalheight NumberMap height. Default value is 1100. If the dpivalue is modified, then thewidthandheightwill be modified proportional to thedpichange. If theheightvalue is modified independently, thedpiandwidthvalues will not be modified.optionaldpi NumberResolution in dots per inch. Default value is 96. If the dpivalue is modified, then thewidthandheightwill be modified proportional to thedpichange.
 
- forceFeatureAttributes BooleanSince: 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
 
- format String
- The output format for the printed map. - Possible Values:"pdf"|"png32"|"png8"|"jpg"|"gif"|"eps"|"svg"|"svgz" - Default Value:png32
 
- layout String
- The layout used for the print output. When the value is - map-onlyor 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: - 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:map-only
 
- layoutOptions Object
- Defines the layout elements. It's an object with the following properties: - Properties:
- optionaltitleText StringThe text used for the map title if the specified layout contains a title text element. optionalauthorText StringThe text used for the author if the specified layout contains an author text element. optionalcopyrightText StringThe text used for the copyright if the specified layout contains a copyright text element. optionalscalebarUnit StringDefault Value:MilesThe unit used for the scalebar. Possible Values:"Miles"|"Kilometers"|"Meters"|"Feet" optionallegendLayers LegendLayer[]An array of LegendLayer containing the ids of the layers that will be included in the legend. Tiled layers and GraphicsLayer will not appear in the legend. If legendLayersis not specified, all operational layers (non-tiled layers) except GraphicsLayer will be present in the legend. To specify that no layers will be included in the legend, setlegendLayer = [].optional An array of name-value pair objects. Use this property to update the text for custom text elements on the page layout. Values must be strings. The custom text elements must exist in the print service. All out-of-the-box print service layout templates contain a text element named datethat gets populated by default with the system date-time, but can be overwritten.
 Example:- layoutOptions: { titleText: "My Print", authorText: "Sam", copyrightText: "My Company", scalebarUnit: "Miles", // the following text elements must // exist in the print service to appear customTextElements: [ {"description": "My description"}, {"location": "My Location"}, {"date": "11/11/2020, 11:11:20 AM"} ] }
- outScale Number
- The optional map scale of the printed map. Only applies when - scalePreserved = true. If- outScaleis less than 1, then the printed map will use the scale of the input map.- Default Value:0
 
- preserveScale BooleanDeprecated since version 4.16. Use PrintTemplate.scalePreserved instead.
- Define whether the printed map should preserve map scale or map extent. If - true, the printed map will use the- outScaleproperty 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
 
- scalePreserved Boolean
- Define whether the printed map should preserve map scale or map extent. If - true, the printed map will use the- outScaleproperty 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
 
- showLabels Boolean
- When - true, labels will be shown on the layout.- Default Value:true