Text symbol not coming after print

1294
11
Jump to solution
09-30-2021 05:09 AM
ADITYAKUMAR1
Occasional Contributor III

Hi,

   I am trying to print the text symbol on the map. The textsymbol is available on the map, but when we print it as PDF it's not available. Any idea why it's happening? I am using ArcGIS JavasScript APi  3.26.

ADITYAKUMAR1_0-1633003531720.png

The text symbol on map.

ADITYAKUMAR1_1-1633003614407.png

Text symbol not available in the print pdf.

 

Below is the code I am using for text symbol.

 

var symbol = new PictureMarkerSymbol(xxxxxurl+ "Images/marker/inspection-map-markers-no-status.png", 22, 22).setOffset(0, 5);
textSymbol = new TextSymbol(stop.attributes.OBJECTID);
textSymbol.setFont(font);
textSymbol.setColor(new Color([255, 255, 255]));
textSymbol.setAlign(TextSymbol.ALIGN_MIDDLE);
textSymbol.setAngle(0);
textSymbol.setOffset(1, 0);
var newGraphic = new Graphic(stop.toJson());
newGraphic.setSymbol(symbol);
graphics.add(newGraphic);
var Graphictext = new Graphic(stop.toJson());
Graphictext.setSymbol(textSymbol);
graphics.add(Graphictext);
stop.setSymbol(textSymbol);

 

Thanks

Aditya Kumar

0 Kudos
11 Replies
ADITYAKUMAR1
Occasional Contributor III

@Bishrant  Sorry for delayed response. I have attached a HTML file. I have tried everything its not working.

But there is a catch in this file. If you go to line number 163 textSymbol = new TextSymbol(i++); On every click the number will change and you wont get the number in the print pdf but if the same number if you make it static textSymbol = new TextSymbol("1");  then you will get the print.

0 Kudos
ADITYAKUMAR1
Occasional Contributor III

@Noah-Sager @Bishrant I finally resolved it. I have changed  textSymbol = new TextSymbol(stop.attributes.OBJECTID); 

to  

textSymbol = new TextSymbol(stop.attributes.OBJECTID.toString());

 

Thanks guys for the help and time. Appreciate your support.

Aditya