print

AMD: require(["esri/rest/print"], (print) => { /* code goes here */ });
ESM: import * as print from "@arcgis/core/rest/print";
Object: esri/rest/print
Since: ArcGIS API for JavaScript 4.20

The print module provides an executePrint method that generates a printer-ready version of the map using an Export Web Map Task available with ArGIS Server 10.1 and later. This class is used when you want to have more granular control over the user interface, for example, if you want to provide users the ability to define what appears on the printed page.

For more information about printing with the MAP_ONLY layout, please see exportOptions.

Use PrintParameters to set the printing options of the task.

Known Limitations

No support

Versioned support

  • CIMSymbol cannot be printed with any Printing Service published with ArcMap.
  • Labels currently cannot be printed as part of a FeatureLayer with ArcGIS Server 10.5.1 or any Printing Service published with ArcMap.
  • ImageryLayer cannot be printed with ArcGIS Server 10.5.1 or earlier, or any Printing Service published with ArcMap.
  • VectorTileLayer printing requires ArcGIS Server 10.5.1 or later.
  • Printing layers rendered with the DotDensityRenderer will create a client-side image of the layer in the printout with ArcGIS Server 10.8.0 or earlier.
  • For printing secure VectorTileLayers with ArcGIS Server 10.5.1 or 10.6.0, or for printing VectorTileLayers with ArcGIS Server 10.5.1 or any Printing Service published with ArcMap, the print will create a client-side image for the VectorTileLayer to use in the printout. This has some limitations related to large size printing quality and a dependency on browser window height/width ratio.
  • Printing the background color of a MapView or WebMap requires ArcGIS Server 10.9 or later.

Behavior notes

  • Printing layers using clustering will create a client-side image of the layer in the printout.
  • The print server does not directly print SVG symbols. Rather, they are converted to PictureMarkerSymbols for display.
  • Make certain that any resources to be printed are accessible by the print server. For example, if printing a map containing PictureMarkerSymbols, the URL to these symbols must be accessible to the print server for it to work properly.
See also:

Method Overview

Name Return Type Summary Object
Promise<PrintResponse>more details

Sends a request to the print service to create a printable static image of the map using the options specified in the PrintParameters.

more detailsprint
Stringmore details

Request the mode for the print request service.

more detailsprint

Method Details

execute(url, params, requestOptions){Promise<PrintResponse>}

Sends a request to the print service to create a printable static image of the map using the options specified in the PrintParameters.

Parameters:
url String

The URL of the REST endpoint of the Export Web Map Task.

Defines the printing options.

requestOptions Object
optional

Additional options to be used for the data request.

Returns:
Type Description
Promise<PrintResponse> Resolves to an object containing the URL of the generated printout of the view.
Example:
const template = new PrintTemplate({
 format: "pdf",
 exportOptions: {
   dpi: 300
 },
 layout: "a4-portrait",
 layoutOptions: {
   titleText: "Gillette Stadium",
   authorText: "Thomas"
 }
});

const params = new PrintParameters({
 view: view,
 template: template
});

execute(url, params).then(printResult).catch(printError);
getMode(url){String}

Request the mode for the print request service. Can only check mode after a print request has been made at least once.

Parameter:
url String

The URL of the REST endpoint of the Export Web Map Task.

Returns:
Type Description
String Returns the mode for the print request execution, either "sync" or "async".

Type Definitions

PrintResponse

Represents the response of the execute() method.

Property:
url String

URL pointing to the location of the generated printout of the view.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.