1

I'm trying to use print task to generate a PNG or PDF file of my web map but i always get an Error code 500, error performing execute operation.

Any Ideas?

I'm using ArcGIS API for JavaScript 3.2.0

var dojoConfig = { async : true };

on(dom.byId("png"),'click', function () {
printTaskSetup("MAP_ONLY", "png32");
})
on(dom.byId("landscape"),'click', function () {
printTaskSetup("A4 Landscape", "PDF");
})
on(dom.byId("portrait"),'click', function () {
printTaskSetup("A4 Portrait", "PDF");
})

function printTaskSetup(layout, format){
var template = new esri.tasks.PrintTemplate(
template.format = format;
template.layout = layout;
template.layoutOptions = {
 "scalebarUnit": "Miles",
 "copyrightText": "Clerk",
 "showAttribution": false
}
template.preserveScale = true;
var params = new esri.tasks.PrintParameters();
params.map = map;
params.template = template;
printTask = new esri.tasks.PrintTask(print URL, dojoConfig);
printTask.submitJob(params, printResult, printError);
}
function printResult(result) {
  window.open(result.url)
}
function printError(error) {
  alert(error);
}
2

it could be more than one thing, but my guess is that you're calling 'execute' and the print task is actually set up as asynchronous or 'submitJob' and its synchronous

in order to tell for sure, browse the REST services directory to see what operation the service actually supports and compare that to the URL that 500s.

if thats the problem, you can set sync/async in the PrintTask constructor parameters.

https://developers.arcgis.com/javascript/jsapi/printtask-amd.html#printtask1

3
  • That was an issue but it still does not work. I adjusted my code but now I don't even get an error message. My rest service was set to async so i adjusted my code accordingly but still having a problem. – user40578 Nov 14 '14 at 15:41
  • { "jobId": "j7afb4e3962974fbb804a42196468dc56", "jobStatus": "esriJobSubmitted" } This is what I'm getting now – user40578 Nov 14 '14 at 16:15
  • 1
    So its "working". With an Async job you need to poll and get the result back when jobStatus is esriJobComplete - this example executes against an async service: developers.arcgis.com/javascript/jssamples/… – KHibma Nov 14 '14 at 17:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.