Comments (5)
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.
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.
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.
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.
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)
- field value should contain hyperlink in a popup obtain from search widget in 2.8 versionWeb App builder developer edition
- Removing infoTemplate on setMapClickMode HOT 2
- Create Dialog Box Dynamically,Get user input values and Add Text Graphics on Map ? HOT 1
- vector tile service 4.x supported? HOT 2
- Toggle Labeling menu LayerControl widget Layers ? HOT 5
- Can only identify top layer in Grouped Layer configuration HOT 5
- add WMS-C layer
- Print Scale Error HOT 3
- can cmv be localized??? HOT 4
- example to use Arcade in a customized identify config file HOT 2
- Feature Server support?
- support arcgis javascript api v3.33? or v3.28 HOT 4
- Are you going to make v4.16 version of CMV? v3.x will retired in 2022 as ESRI claimed HOT 4
- Save Layer Visibility State in URL Query Params HOT 2
- How put an accordion in left pane HOT 2
- BUG? - LayerControl doesn´t show all simbology
- Doubt: how open sidebarBottom programatically? HOT 1
- Zoom Level in Attribute Grid HOT 1
- Missing iconClass in widget config causes crash while loading on mobile HOT 1
- Home Button bug HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cmv-app.