print task not showing custom graphic layer as point clustering example

1158
3
10-19-2017 03:48 AM
Faris_TawfiqAbdelFattah
New Contributor

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

0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Emeritus

Faris,

  To my knowledge Custom Graphics Layer have never been supported by the print task.

Faris_TawfiqAbdelFattah
New Contributor

Thank you Robert for the replay, 

Is there a workaround for  this solution ???

should i use the print widget for example .

Thanks

Faris 

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

No the print widget just uses the print task behind the scenes. There is no workaround I am aware of. It is just a limitation to using custom graphics.

0 Kudos