Hello,
I'm trying to implement a print widget in my application using a geoprocessor
I have a print button. every time it's clicked it should go to this function
function print() {
gp = new Geoprocessor('url');
var Web_Map_as_JSON = "";
params2 = { "Web_Map_as_JSON": Web_Map_as_JSON, "Format": "PDF" };
gp.submitJob(params2, printResult);
}
function printResult(jobInfo) {
gp.getResultData(jobInfo.jobId, "Output_File", displayResult);
}
function displayResult(results, messages) {
window.open(results.value.url, "_blank");
alert(messages);
}
The problem is that one of the parameters Web_Map_as_JSON should have the map Json string. Is there any function in javascript that can have the Json string of the map?. I tried to do it manually but I get an empty map PDF or an error page.
Isra,
The simple answer is no there is not a method in JS API for this. But here are a couple of threads that discuss this and suggest possible work arounds:
How to Convert Esri.Map object to json
JSON.stringify esri.map object
http://stackoverflow.com/questions/34346304/get-json-webmap-from-arcgis-javascript-api-map-object
Thank you Robert!
I guess I'll have to find another way