PrintTask
require(["esri/tasks/PrintTask"], function(PrintTask) { /* code goes here */ });
esri/tasks/PrintTask
The PrintTask 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
- There is no current support for printing SceneViews. Instead, see SceneView.takeScreenshot().
- There is no current support for printing layer blending. Instead, see MapView.takeScreenshot().
- There is no current support for printing highlighted features. Instead, see MapView.takeScreenshot().
- There is no current support for printing ImageryLayers when a pixelFilter is defined.
- There is no current support for printing renderers generated from univariateColorSize.createContinuousRenderer() with an above-and-below theme.
- There is no current support for printing legend items for layers that are sent as a client-side image in the printout.
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 PrintTask 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.
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:
Constructors
- new PrintTask(properties)
- Parameter:properties Objectoptional
See the properties for a list of all the properties that may be passed into the constructor.
Property Overview
Name | Type | Summary | Class | |
---|---|---|---|---|
String | The name of the class. more details | more details | Accessor | |
String | The mode for the print task execution. more details | more details | PrintTask | |
Object | The options to be used for data requests. more details | more details | Task | |
Number | The time interval in milliseconds between each job status request sent to an asynchronous GP task. more details | more details | PrintTask | |
String | The URL of the REST endpoint of the Export Web Map Task. more details | more details | PrintTask |
Property Details
- Since: ArcGIS API for JavaScript 4.7
The name of the class. The declared class name is formatted as
esri.folder.className
.
- mode Stringreadonly
The mode for the print task execution.
Possible Values:"async"|"sync"
- Default Value:sync
The options to be used for data requests. These options can also be controlled through the
requestOptions
method parameter.
- updateDelay Number
The time interval in milliseconds between each job status request sent to an asynchronous GP task.
- Default Value:1000
- url String
The URL of the REST endpoint of the Export Web Map Task.
Example:var printTask = new PrintTask({ url: printUrl });
Method Overview
Name | Return Type | Summary | Class | |
---|---|---|---|---|
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. more details | more details | PrintTask |
Method Details
- execute(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:params PrintParametersDefines the printing options.
requestOptions ObjectoptionalAdditional options to be used for the data request (will override requestOptions defined during construction).
Returns:Type Description Promise<PrintResponse> Resolves to an object containing the URL of the generated printout of the view. Example:var printTask = new PrintTask({ url: printUrl }); var template = new PrintTemplate({ format: "pdf", exportOptions: { dpi: 300 }, layout: "a4-portrait", layoutOptions: { titleText: "Warren Wilson College Trees", authorText: "Sam" } }); var params = new PrintParameters({ view: view, template: template }); printTask.execute(params).then(printResult, printError);