import CustomTemplate from "@arcgis/core/widgets/Print/CustomTemplate.js";const CustomTemplate = await $arcgis.import("@arcgis/core/widgets/Print/CustomTemplate.js");- Inheritance:
- CustomTemplate→
Accessor
- Since
- ArcGIS Maps SDK for JavaScript 4.18
Defines the custom layout template options used by the Print widget and Print component to generate the print page. While custom templates can be published from ArcGIS Pro to a portal, custom layout templates are defined in a portal, where they can be added, removed, or edited as necessary without having to republish the print service. There are a limited number of options available for customization.
The main benefit of this class is that it allows developers to give a name to a preferred format and layout
and if there should be a Legend present or not, in a reusable way. This is what the UI looks like in a portal:
- See also
Print widget - Deprecated since 4.33. Use the Print component instead.
Constructors
Constructor
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| properties | | |
Properties
| Property | Type | Class |
|---|---|---|
declaredClass readonly inherited | ||
description readonly | | |
| | ||
id readonly | | |
label readonly | | |
layout readonly | | |
layoutItem readonly | PortalItem | null | undefined | |
layoutOptions readonly | | |
layoutTemplateInfo readonly | | |
mapSurroundInfoOptions readonly | | |
pageUnits readonly | | |
state readonly | "loaded" | "not-loaded" | "loading" | "error" | |
type deprecated readonly | |
id
- Type
- string
- Since
- ArcGIS Maps SDK for JavaScript 4.33
Unique id for the template.
layout
- 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:
| Value | Description |
|---|---|
| map-only | Map does not contain any layout elements. Only the 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 |
layoutItem
- Type
- PortalItem | null | undefined
The portal item associated with layout (if any).
layoutOptions
- Type
- LayoutOptions | null | undefined
Defines the layout elements. It's an object with the following property:
layoutTemplateInfo
- Type
- LayoutTemplateInfo | null | undefined
- Since
- ArcGIS Maps SDK for JavaScript 4.33
Defines the layout template info for the layout item.
mapSurroundInfoOptions
- Type
- MapSurroundInfoOptions | null | undefined
- Since
- ArcGIS Maps SDK for JavaScript 4.33
This object returns settings for a legend, north arrow and scale bar (if any).
Methods
fromJSON
- Signature
-
fromJSON (json: any): any
Creates a new instance of this class and initializes it with values from a JSON object
generated from an ArcGIS product. The object passed into the input json
parameter often comes from a response to a query operation in the REST API or a
toJSON()
method from another ArcGIS product. See the Using fromJSON()
topic in the Guide for details and examples of when and how to use this function.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| json | A JSON representation of the instance in the ArcGIS format. See the ArcGIS REST API documentation for examples of the structure of various input JSON objects. | |
- Returns
- any
Returns a new instance of this class.
toJSON
- Signature
-
toJSON (): any
Converts an instance of this class to its ArcGIS portal JSON representation. See the Using fromJSON() guide topic for more information.
- Returns
- any
The ArcGIS portal JSON representation of an instance of this class.
Type definitions
MapSurroundInfoOptions
northArrow
- Type
- Extract<MapSurroundInfo, { type: "cim-marker-north-arrow"; }>[]
MapSurroundInfo for north arrow.
scaleBar
- Type
- Extract<MapSurroundInfo, { type: "cim-scale-line" | "cim-group-element"; }>[]
MapSurroundInfo for scale bar.
legend
- Type
- Extract<MapSurroundInfo, { type: "cim-legend"; }>[]
MapSurroundInfo for legend.
