Printing a textSymbol

2609
3
Jump to solution
12-16-2014 05:25 AM
IbrahimHussein
Occasional Contributor

Hey guys, I am making a measurement app, and I am adding the measurements on every click as a graphic(point, textSymbol) and I am setting the color to white. Now on the map it shows up as white, but when I print the result, the measurement text comes out black. Cant seem to figure out whats going on, any ideas?

measure.jpg

0 Kudos
1 Solution

Accepted Solutions
NicholasHaney
New Contributor III

I've seen this sort of thing happen before when working with fonts. I downloaded your code and rewrote the part that creates the text symbols. Using the verbose method of creating the symbol fixed the issue for me. This is the code I used:

var font = new Font();

  font.setSize("15pt");

  font.setWeight(Font.WEIGHT_BOLDER);

  font.setFamily("Candara");

  var color = new Color();

  color.setColor([255, 255, 255]);

  var textSymbol = new TextSymbol()

  textSymbol.setText(zero.toFixed(1).toString()+"'");

  textSymbol.setFont(font);

  textSymbol.setColor(color);

  textSymbol.setAlign(Font.ALIGN_MIDDLE);

  textSymbol.setAngle(0);

  totalLength += zero;

  mx = (parseFloat(x1)+parseFloat(x))/2;

  my = (parseFloat(y1)+parseFloat(y))/2;

  var labelPoint = new Point(mx,my);   

  var labelPointGraphic = new Graphic();

  labelPointGraphic.setGeometry(labelPoint);

  labelPointGraphic.setSymbol(textSymbol);

View solution in original post

3 Replies
NicholasHaney
New Contributor III

I've seen this sort of thing happen before when working with fonts. I downloaded your code and rewrote the part that creates the text symbols. Using the verbose method of creating the symbol fixed the issue for me. This is the code I used:

var font = new Font();

  font.setSize("15pt");

  font.setWeight(Font.WEIGHT_BOLDER);

  font.setFamily("Candara");

  var color = new Color();

  color.setColor([255, 255, 255]);

  var textSymbol = new TextSymbol()

  textSymbol.setText(zero.toFixed(1).toString()+"'");

  textSymbol.setFont(font);

  textSymbol.setColor(color);

  textSymbol.setAlign(Font.ALIGN_MIDDLE);

  textSymbol.setAngle(0);

  totalLength += zero;

  mx = (parseFloat(x1)+parseFloat(x))/2;

  my = (parseFloat(y1)+parseFloat(y))/2;

  var labelPoint = new Point(mx,my);   

  var labelPointGraphic = new Graphic();

  labelPointGraphic.setGeometry(labelPoint);

  labelPointGraphic.setSymbol(textSymbol);

IbrahimHussein
Occasional Contributor

Thanks, its been driving me crazy since everything looked correct. Your suggestion worked perfectly!

0 Kudos
CMC111
by
New Contributor

Hi

I have same problem with textsymbol in printing layout. No matter what color i use, the printing map symbols always still black.

I try the example but not working. zero not defined.

You can send more code for this?

thanks

Joao

0 Kudos