PrintTask not printing polyline

834
3
06-02-2014 10:15 AM
SandraDema
New Contributor
I am trying to create a polyline symbol, add it to a map, and then use PrintTask to create a jpg.
Everything appears to be ok on screen, but when I run the print task, the lines are not there (see attachments).
Has anyone seen this before?

//create vertical line
var point1 = new esri.geometry.Point(xLoc, 1920322.017, CountyMap.spatialReference);
var point2 = new esri.geometry.Point(xLoc, 1795070.155, CountyMap.spatialReference);
var line = new esri.geometry.Polyline(CountyMap.spatialReference);
line.addPath([point1, point2]);
var lineSymbol = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([0, 0, 0]), 2);
LineGraphic = new esri.Graphic(line, lineSymbol)

//add vertical line to CountyMap
CountyVLineLayer = new esri.layers.GraphicsLayer();
var CountyVLineRenderer = new SimpleRenderer(lineSymbol);
CountyVLineLayer.setRenderer(CountyVLineRenderer);
CountyMap.addLayer(CountyVLineLayer);
CountyVLineLayer.add(LineGraphic);

//create horizontal line
var point1 = new esri.geometry.Point(834451.011, yLoc, CountyMap.spatialReference);
var point2 = new esri.geometry.Point(949493.516, yLoc, CountyMap.spatialReference);
var line = new esri.geometry.Polyline(CountyMap.spatialReference);
line.addPath([point1, point2]);
var lineSymbol = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([0, 0, 0]), 2);
LineGraphic = new esri.Graphic(line, lineSymbol)

//add vertical line to CountyMap
CountyHLineLayer = new esri.layers.GraphicsLayer();
var CountyHLineRenderer = new SimpleRenderer(lineSymbol);
CountyHLineLayer.setRenderer(CountyHLineRenderer);
CountyMap.addLayer(CountyHLineLayer);
CountyHLineLayer.add(LineGraphic);
0 Kudos
3 Replies
TammyBearly
New Contributor
Switch these two lines:
CountyMap.addLayer(CountyVLineLayer);
CountyVLineLayer.add(LineGraphic);

Tammy
0 Kudos
by Anonymous User
Not applicable
Original User: ssdema

I tried swapping those two lines, but unfortunately, I am still getting the same results.

I find it very odd that the graphic appears fine on screen but the print task is unable to render it properly.
0 Kudos
JeffPace
MVP Alum
does the printtask support multiple graphics layers? i didnt think it did

have you tried adding the graphic to the default map.graphics instead of instantiating a second graphicslayer?
0 Kudos