Hi @Noah-Sager - I have investigated more today and have learnt more about the issue. I have tried multiple print servers (e.g. https://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%...) but the problem is all about the content of the webmap json. The problem feature layer labels are defined here and applied to the layer:
const devicesLabelClass = new LabelClass({
labelExpressionInfo: { expression: '$feature.sequence_no' },
labelPlacement: 'above-right',
symbol: {
type: 'text', // autocasts as new TextSymbol()
color: 'black',
haloSize: 1.5,
haloColor: 'white',
font: { // autocast as new Font()
size: 10,
weight: 'bold',
family: 'Arial',
style: 'italic'
}
},
maxScale: 0,
minScale: 25000
});
The problem layer is a dynamic layer loaded from graphics I built from json data. The problem occurs when I have applied a unique-value renderer in the layer which means that the resulting featureSet for the points only includes the geometry and the single attribute which is being used for rendering. The attribute used in the map for labeling i.e. 'sequence_no' is missing and hence the labeling does not work in the print export.
"attributes": {
"device_id_in_source_system": "111"
}
As a contrast there is another dynamic layer (polygons but with the same attributes) in my sample file which has a simple renderer applied and that featureSet includes all the attributes in the feature layer.
"attributes": {
"OBJECTID": 36,
"crime_ref": "BC-B",
"from_date_time": 1606811400000,
"to_date_time": 1606842000000,
"general_text": "Break-in at Honeysuckle Cottage", etc
If I manually add the attribute into the json for the points then the print service correctly prints the labels.
Really I think the creation of webmap json should detect if there are any labels active on a layer and ensure that attribute is included rather than just the one used for rendering.
Hopefully that explains a little more. I am currently trying a workaround (with some success) by intercepting the file using esriConfig.request.interceptors.push : BeforeInterceptorCallback to try and transfer some attributes i.e. the label attribute from the other layer in the file which luckily matches in schema. Without the other layer I would have nothing to help create some label values.
Cheers