Print widget - Problem with custom request parameters

03-04-2021 12:25 AM
New Contributor


We recently updated our ArcGIS JS API version from 4.13 to 4.18 and there seems to be a problem with sending custom request parameters for Print widgets' printServiceUrl.

Basically we have our own proxy/api ("/api/GPServer/Export Web Map") for printing, and we require some extra request parameters so we can highlight the selected features on the map for the print.


const print = new Print({
	printServiceUrl: "/api/GPServer/Export Web Map?customPrintParameters={example: parameters}"


We pass extra request parameters to Print widgets' printServiceUrl, but the request parameter (customPrintParameters) is always null in our backend api when the print widget is used within the app.

This was working fine with v4.13. Is this behaviour intended and is there some other way the custom request parameters could be sent to our backend with the Print widget? 

0 Kudos
3 Replies
Frequent Contributor II

Can you add them to the PrintParameters.extraParameters property?


That should be how custom parameters are sent. I'm surprised it worked before in the print service url, technically I don't think it should have.

0 Kudos
New Contributor

Hmm, doesn't this mean we would need to switch from the Print widget to PrintTask, or is there some way the PrintParameters can be applied to the Print widget? It seems like lots of extra work to switch to PrintTask and according to some samples I found we would lose the widget window that includes all the file formats/layout options etc.

It has been extremely simple just to add the extra parameters to the Print widgets' printServiceUrl.

0 Kudos
Esri Regular Contributor
We are considering this for a future enhancement of the Print widget. In the meantime:
If not, it looks like the print() method on the ViewModel can pass a PrintTemplate:
0 Kudos