Textsymbol not printing at all

2923
19
Jump to solution
07-03-2019 06:11 AM
DeanWilson
New Contributor III

I've seen a lot of the textsymbol questions in the forums here and have tried every one of them.  My issue is the textsymbol doesn't show up at all on the print.  It shows on the map as built.  Here's the code as to how I'm putting this together.  I also tried putting this layer together by itself (to take the fact there are multiple graphics layers out of the scenario) and still getting the same issues.  Here's my method:

_buildRatioViewerGraphics: function(ratioViewerData){
let features = [];
let textFeatures = [];

arrayUtils.forEach(ratioViewerData, lang.hitch(this, function(ratioFeature){
   let polySymbol = new SimpleFillSymbol(
      SimpleFillSymbol.STYLE_SOLID,
      new SimpleLineSymbol(
         SimpleLineSymbol.STYLE_SOLID,
         new Color(this._ratioColorPicker(ratioFeature.attributes.ratio)),
         0.4
      ),
      new Color(this._ratioColorPicker(ratioFeature.attributes.ratio))
   );
   let featureGraphic = new Graphic(ratioFeature);
   featureGraphic.setSymbol(polySymbol);
   features.push(featureGraphic);

   let textColor = new Color();
   textColor.setColor([0, 0, 0, 1]);

   let textFont = new Font();
   textFont.setSize("12pt");
   textFont.setWeight(Font.WEIGHT_BOLD);
   textFont.setFamily("Arial");

   let textSymbol = new TextSymbol()
      .setText(this._formatRoutingNumberLabel(ratioFeature.attributes.routingNumber))
      .setFont(textFont)
      .setColor(textColor)
      .setAlign(Font.ALIGN_MIDDLE)
      .setAngle(0)
      .setHaloColor(new Color([255, 255, 255, 0.3]))
      .setHaloSize(1);
      textSymbol.horizontalAlignment = "center";
      textSymbol.verticalAlignment = "center";
      let textFeatureGraphic = new Graphic(ratioFeature);
      textFeatureGraphic.setSymbol(textSymbol);
      textFeatures.push(textFeatureGraphic);
   }));

   this.featureLayer.applyEdits(features, null, null);
   this.textFeatureLayer.applyEdits(textFeatures, null, null);

return features;
}
0 Kudos
1 Solution

Accepted Solutions
TanuHoque
Esri Regular Contributor

Thanks Dean Wilson‌.

It looks like the graphic layer that your JS code creates to show text, are of polygon type. That is currently not supported in print services.

Try change that to point geometry type. That should make it to work.

see the attached .zip file that is a modified version of what you sent me. if you use that in a request to your print service, you should see one feature gets labeled (to keep it simple, I removed all other labels from the json).

hope this helps.

View solution in original post

19 Replies
DeanWilson
New Contributor III

Bumping this question.... Just checking to see if I should word this any different maybe? Still not functioning right.

0 Kudos
SeanMcCullough
New Contributor
0 Kudos
DeanWilson
New Contributor III

Thanks for the tip. I'll look into the labeling part of it.  But, what if I only have a text symbol? Those are the things that aren't printing.  I can take out the other graphic features and just leave the textsymbol and it doesn't show up in the print.  

P.S. I didn't add this before, and I should have, but I'm using the 3.x api, not the 4.x..

0 Kudos
Noah-Sager
Esri Regular Contributor

I did a quick sanity check and I am able to print TextSymbols with 3.29. Couple questions for you:

1) What (ArcGIS Server) version of the print service are you using? If you try the AGO print service, do you get the same result?

printUrl = "https://utility.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task";

2) Are you adding those TextSymbols as a GraphicsLayer to a FeatureLayer through the applyEdits() method? Do you see the TextSymbols in the printout if you just add the GraphicsLayer (or each Graphic) to the map?

0 Kudos
DeanWilson
New Contributor III

Hi Noah,

To answer your questions:

1) We're using arcgis server 10.4.1 for all of our services, including the print service.

2) Yes I'm adding the textsymbols as graphics to a featurelayer thru applyEdits().  The textsymbols are on the map as displayed, just not in the prints.  The rub with all of this is I'm building the feature layers off of a featurecollection that uses the attributes that I make, not the arcgis server.  Maybe thats the issue but I'm not 100%.  There's really not much I can do about that because I'm pulling the attribute data from a third party sql server on premise, and not attributes from arcgis.  Hopefully that makes sense.. let me know if i have to explain that different.  

-Dean

0 Kudos
Noah-Sager
Esri Regular Contributor

Thanks Dean. There were two other things I was hoping you could test. I'll re-word the second to make it more clear:

1) If you try the AGO print service, do you get the same result?

printUrl = "https://utility.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%...";

 

2) Do you see the TextSymbols in the printout if you just add the GraphicsLayer (or each Graphic) to the map instead of adding them to a FeatureLayer first?

0 Kudos
DeanWilson
New Contributor III

Noah,

The print widget that I'm using (I'm utilizing the print widget from webappbuilder)  Won't take the url that you mentioned when I put it in the config for "serviceUrl".  Any ideas on that?  

I did add the textsymbols straight to the map using:

this.map.graphics.add(textFeatureGraphic);

But still not showing on the print. It may be the print service in 10.4 has a bug in it.. Not sure how I can test that other then upgrading the arcgis server we have on-premise.

0 Kudos
DeanWilson
New Contributor III

Another bump on this question. I've tried the few things Noah mentioned but to no avail.  Is this a print service issue that's used in 10.4 server? 

0 Kudos
DeanWilson
New Contributor III

Bump! Hopefully this doesn't fall into the GEONET black hole..  

0 Kudos