- See also
Method Overview
Name | Return Type | Summary | Object |
---|---|---|---|
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 | ||
String | Request the mode for the print request service. more details |
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.
Parametersurl StringThe URL of the REST endpoint of the Export Web Map Task.
params PrintParametersDefines the printing options.
requestOptions ObjectoptionalAdditional options to be used for the data request.
ReturnsType Description Promise<PrintResponse> Resolves to an object containing the URL of the generated printout of the view. Examplerequire([ "esri/rest/print", "esri/rest/support/PrintTemplate", "esri/rest/support/PrintParameters" ], function(print, PrintTemplate, PrintParameters) { // url to the print service const url = "https://utility.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task"; const template = new PrintTemplate({ format: "pdf", exportOptions: { dpi: 300 }, layout: "a4-portrait", layoutOptions: { titleText: "Gillette Stadium", authorText: "Thomas B." } }); const params = new PrintParameters({ view: view, template: template }); // print when this function is called function executePrint() { print.execute(url, params).then(printResult).catch(printError); } function printResult(result) { console.log(result.url); window.open(result.url); } function printError(err) { console.log("Something broke: ", err); } });
-
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.
Parameterurl StringThe URL of the REST endpoint of the Export Web Map Task.
ReturnsType Description String Returns the mode for the print request execution, either "sync" or "async".