Giter Club home page Giter Club logo

Comments (5)

DavidSpriggs avatar DavidSpriggs commented on June 12, 2024

In order for this to work the export webmap spec needs to be followed. Have a look at the spec and make sure you are properly defining the text symbol.
http://resources.arcgis.com/en/help/main/10.2/index.html#/ExportWebMap_specification/0154000004w8000000/
http://resources.arcgis.com/en/help/rest/apiref/index.html?symbol.html (see the text symbol section)

Also, if the api is not serializing the text symbols properly you can use aspect to modify the json before it is submitted like so:

postCreate: function() {
    this.printTask = new esri.tasks.PrintTask(this.printTaskURL);
    aspect.after(this.printTask, '_createOperationalLayers', this.operationalLayersInspector, false);
},
operationalLayersInspector: function(opLayers) {
    array.forEach(opLayers, function(layer) {
        if (layer.id == "Measurement_graphicslayer") {
            array.forEach(layer.featureCollection.layers, function(fcLayer) {
                array.forEach(fcLayer.featureSet.features, function(feature) {
                    delete feature.attributes;
                    feature.symbol.font.family = "Courier";
                    feature.symbol.font.variant = esri.symbol.Font.VARIANT_NORMAL;
                    feature.symbol.font.size = "32pt";
                });
            });
        }
    });
    return opLayers;
},

from cmv-app.

archerne avatar archerne commented on June 12, 2024

It looks correct to me when the JSON gets set. For some reason though the
export web map returns it as black. Here is the JSON that is sent, at the
bottom you see the esriTS and color blue:

{
      "id": "drawGraphics_poly",
      "minScale": 0,
      "maxScale": 0,
      "featureCollection": {
        "layers": [
          {
            "layerDefinition": {
              "name": "drawGraphics_poly",
              "geometryType": "esriGeometryPoint",
              "drawingInfo": {
                "renderer": {
                  "type": "uniqueValue",
                  "field1": "ren",
                  "field2": null,
                  "field3": null,
                  "fieldDelimiter": ", ",
                  "defaultSymbol": {
                    "color": [
                      0,
                      0,
                      0,
                      64
                    ],
                    "outline": {
                      "color": [
                        0,
                        0,
                        0,
                        255
                      ],
                      "width": 1,
                      "type": "esriSLS",
                      "style": "esriSLSSolid"
                    },
                    "type": "esriSFS",
                    "style": "esriSFSSolid"
                  },
                  "uniqueValueInfos": [
                    {
                      "value": "1",
                      "symbol": {
                        "color": [
                          255,
                          170,
                          0,
                          255
                        ],
                        "outline": {
                          "color": [
                            255,
                            170,
                            0,
                            255
                          ],
                          "width": 1,
                          "type": "esriSLS",
                          "style": "esriSLSSolid"
                        },
                        "type": "esriSFS",
                        "style": "esriSFSForwardDiagonal"
                      },
                      "label": "User drawn polygons",
                      "description": "User drawn polygons"
                    }
                  ]
                }
              },
              "fields": [
                {
                  "name": "OBJECTID",
                  "type": "esriFieldTypeOID",
                  "alias": "OBJECTID",
                  "editable": false,
                  "nullable": false
                },
                {
                  "name": "ren",
                  "type": "esriFieldTypeInteger",
                  "alias": "ren",
                  "editable": true,
                  "nullable": false
                }
              ]
            },
            "featureSet": {
              "geometryType": "esriGeometryPoint",
              "features": [
                {
                  "geometry": {
                    "x": -11028877.012590744,
                    "y": 4953918.636584341,
                    "spatialReference": {
                      "wkid": 102100
                    }
                  },
                  "symbol": {
                    "color": [
                      0,
                      0,
                      205,
                      255
                    ],
                    "type": "esriTS",
                    "angle": 0,
                    "xoffset": 0,
                    "yoffset": 0,
                    "text": "Text12341243123",
                    "align": "middle",
                    "decoration": "none",
                    "rotated": false,
                    "kerning": true,
                    "font": {
                      "size": 20,
                      "style": "normal",
                      "weight": "normal"
                    }
                  }
                }
              ]
            }
          }
        ]
      }
    }

from cmv-app.

DavidSpriggs avatar DavidSpriggs commented on June 12, 2024

So the issue here I think is how the layer is symbolized. When printing you have to think like desktop. Meaning that in desktop, you do not apply symbology to an individual feature but rather set up a renderer on the layer.

Basically the individual features' symbol properties are ignored, only renderers are applied.

In your json above, you have a render with a default value set but no classes defined. This is why they are all symbolized with the default symbol, which is black text.

To fix, set up a render with a class for each color. Then each feature needs an attribute to put it in the proper class. Make sense?

Again, this is due to the fact that we can do things on the web that can not be done in desktop, like apply a symbol to each feature directly. The rendering of the map into a pdf (or other formats) happens in a desktop/server context (ArcObjects) so we have to follow those rules.

from cmv-app.

archerne avatar archerne commented on June 12, 2024

I tried changing the default symbol color, and it still printed in black. I changed it to:

"defaultSymbol": {
                    "color": [
                      255,
                      0,
                      0,
                      64
                    ],
                    "outline": {
                      "color": [
                        255,
                        0,
                        0,
                        255
                      ],

I also tried a ClassBreakRenderer and it still stayed black there as well. I have the JSON sting for that too, if that would help.

from cmv-app.

green3g avatar green3g commented on June 12, 2024

I'm fairly certain this has been fixed in more recent updates. I'm able to print colored text.

from cmv-app.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.