AnsweredAssumed Answered

print task not showing custom graphic layer as point clustering example

Question asked by fata45 on Oct 19, 2017
Latest reply on Oct 22, 2017 by rscheitlin

dear all 

Am trying to print the custom graphic layer as the cluster point example ESRI JS clustering example using the print task class. the problem i had the is that when printing execute, the print results doesn't show the custom graphic layer (cluster) but showing only the base map layer (dynamic), am using arcgis 10.4 with 3.21 JS version, here is my code for the print functionality. is there something i should consider in my code.

 

function PrintMap() {
// print functionality
var printURL = "http://arcgissrv/server/rest/services/Utilities/PrintingTools/GPServer/Export Web Map Task"; (not the real url)
var printTask = new PrintTask(printURL);
// prepare print template
var printTemplate = new PrintTemplate();
printTemplate.format = "PDF"; // values pdf | png32 | png8 | jpg | gif | eps | svg | svgz
printTemplate.preserveScale = true;
printTemplate.label = "print"; // The text that appears on the Print widget's print button.
printTemplate.layout = "A4 Landscape"; // values MAP_ONLY, A3 Landscape, A3 Portrait, A4 Landscape, A4 Portrait, Letter ANSI A Landscape, Letter ANSI A Portrait, Tabloid ANSI B Landscape, Tabloid ANSI B Portrait
printTemplate.showAttribution = true;
printTemplate.showLabels = true;
printTemplate.layoutOptions = {
// "authorText": dom.byId('txt_PrintMapAuthor').value,
"legendLayers": [],
"titleText": dom.byId('txt_PrintMapTitle').value,
"scalebarUnit": "Kilometers",// 'Miles' | 'Kilometers' | 'Meters' | 'Feet'. Default is "Miles",
"Content_text": "AAAAAAAAAAAAAA",
};

 

var printParams = new PrintParameters();

printParams.map = map;
printParams.template = printTemplate;

// set the function when print task excuted the function fingure print is execute(printParameters, callback?, errback?)
printTask.execute(printParams, printResult, printError);

 

function printResult(result) {
window.open(result.url)

}; // function print result

 

function printError(parm) {
alert(parm);
}; // function printError

Outcomes