Hide Table of Contents
esri/dijit/util
esri/layer/pixelFilters
esri/process
esri/support
esri/workers
Class: PrintTemplate

dojo.require("esri.tasks.PrintTemplate")

Description

(Added at v2.6)
Define the layout template options used by the PrintTask and Print widget to generate the print page.

Samples

Search for samples that use this class.

Constructors

NameSummary
new esri.tasks.PrintTemplate()Creates a new PrintTemplate object.

Properties

NameTypeSummary
exportOptionsObjectDefine the map width, height and dpi.
forceFeatureAttributesBooleanWhen true, the feature's attributes are included in feature collection layers even when they are not needed for rendering.
formatStringThe print output format.
labelStringThe text that appears on the Print widget's print button.
layoutStringThe layout used for the print output.
layoutOptionsObjectDefine the layout elements.
outScaleNumberThe optional map scale of the printed map.
preserveScaleBooleanDefine whether the printed map should preserve map scale or map extent.
showAttributionBooleanWhen false, attribution is not displayed on the printout.
showLabelsBooleanIndicates whether visible LabelLayers in the map are displayed or not.
Constructor Details

new esri.tasks.PrintTemplate()

Creates a new PrintTemplate object.
Sample:
var template = new esri.tasks.PrintTemplate();
Property Details

<Object> exportOptions

Define the map width, height and dpi. Required when the layoutTemplate is set to 'MAP_ONLY'. exportOptions is an object with the following structure:
  {
    <Number> width,
    <Number> height,
    <Number> dpi
  }
Sample:
template.exportOptions = {
  width: 500,
  height: 400,
  dpi: 96
};

<Boolean> forceFeatureAttributes

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. (Added at v3.24)
Default value: false

<String> format

The print output format.
Known values: pdf | png32 | png8 | jpg | gif | eps | svg | svgz
Sample:
  template.format = "PDF";

<String> label

The text that appears on the Print widget's print button.

<String> layout

The layout used for the print output. The print service provides the following out-of-the-box templates:
  • 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
The server administrator can add additional templates to the print service.
Sample:
  template.layout = "MAP_ONLY";

<Object> layoutOptions

Define the layout elements. Is an object with the following properties:
titleText The text used for the map title if the specified layout contains a title text element.
authorText The text used for the author if the specified layout contains an author text element.
copyrightText The text used for the copyright if the specified layout contains an copyright text element.
scalebarUnit The units used for the scalebar. Valid values are 'Miles' | 'Kilometers' | 'Meters' | 'Feet'. Default is "Miles".
legendLayers <esri.tasks.LegendLayer[]> An array of LegendLayer containing the id's of the layers that will be included in the legend. If legendLayers is not specified, all operational layers (non-tiled layers) will be present in the legend. To specify that no layers will be included in the legend set legendLayer to an empty array.
customTextElements <Object[]> Updated the text for a TextElement, that is not DynamicText, on the page layout. Values must be strings.

<Number> outScale

The optional map scale of the printed map. Only applies when preserveScale is true. If outScale is less than 1, then the printed map will use the scale of the input map. (Added at v3.11)

<Boolean> preserveScale

Define whether the printed map should preserve map scale or map extent. If true, the printed map will use the outScale property or default to the scale of the input map. If false, then the printed map will use the same extent as the input map and thus scale might change.
Default value: false

<Boolean> showAttribution

When false, attribution is not displayed on the printout. This only applies when the layout value is MAP_ONLY. When true, it will honor the showAttribution property of the map object. Reference our policies on Licensing & Attribution for specific attribution requirements. (Added at v3.3)
Known values: true | false
Default value: true

<Boolean> showLabels

Indicates whether visible LabelLayers in the map are displayed or not. (Added at v3.14)
Default value: true
Show Modal