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
See print for a detailed list of known limitations.
- 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 | more details The name of the class. | more details | Accessor | |
String | more details The mode for the print task execution. | more details | PrintTask | |
Number | more details The time interval in milliseconds between each job status request sent to an asynchronous GP task. | more details | PrintTask | |
String | more details The URL of the REST endpoint of the Export Web Map Task. | 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
-
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:let printTask = new PrintTask({ url: printUrl });
Method Overview
Name | Return Type | Summary | Class | |
---|---|---|---|---|
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 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.
Returns:Type Description Promise<PrintResponse> Resolves to an object containing the URL of the generated printout of the view. Example:let printTask = new PrintTask({ url: printUrl }); let template = new PrintTemplate({ format: "pdf", exportOptions: { dpi: 300 }, layout: "a4-portrait", layoutOptions: { titleText: "Warren Wilson College Trees", authorText: "Sam" } }); let params = new PrintParameters({ view: view, template: template }); printTask.execute(params).then(printResult, printError);