A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-print.html below:

print | API Reference | ArcGIS Maps SDK for JavaScript 4.33

ESM: import * as print from "@arcgis/core/rest/print.js";

CDN: const print = await $arcgis.import("@arcgis/core/rest/print.js");

Object: @arcgis/core/rest/print

Since: ArcGIS Maps SDK 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.

Known Limitations

No support

Versioned support

Behavior notes

Method Overview Name Return Type Summary Object execute() 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.

print getMode() Promise<String>

Request the mode for the print request service.

print Method Details
execute Method 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

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

Defines the printing options.

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 [print, PrintTemplate, PrintParameters] = await $arcgis.import([
 "@arcgis/core/rest/print.js",
 "@arcgis/core/rest/support/PrintTemplate.js",
 "@arcgis/core/rest/support/PrintParameters.js"
]);

// 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 Method getMode(url){Promise<String>}

Request the mode for the print request service.

Parameter

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

Returns

Type Description Promise<String> Returns the mode for the print request execution, either "sync" or "async".
Type Definitions
PrintResponse Type Definition PrintResponse

Represents the response of the execute() method.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4