label missing print

209
6
08-18-2020 03:19 AM
ReaganSenoron
New Contributor II

Hi,

We have a FeatureLayer with Polylines/Point and some labels. When we do an export/print to PDF, the Polylines/Point is printed out EXCEPT for the labels. I have been searching the web and I couldn't find any meaningful solution.

Does anyone have similar problem? And how did you solve this? Thanks.

0 Kudos
6 Replies
ZaraMatheson
Esri Contributor

Hello, Are you able to share a copy of the layer or web map you are trying to print from so we can take a closer look?

Thanks!

0 Kudos
ReaganSenoron
New Contributor II

Hi,

Here is a snippet of the code,

protected addLayer(mapView: __esri.MapView, items: itemDetailDTO[])
: Observable<{ layer: __esri.Layer, features: Partial<__esri.Graphic>[] }> {
const features = items?.map(w => this.mapFeature(w)) || [];
const layer = new this.esriTypesService.FeatureLayer({
id: this.store.state.mapConfiguration[someConfig],
title: this.localizationService.values.layerLabel,
fields: xFields,
source: features,
objectIdField: EsriObjectFields.objectId,
spatialReference: { wkid: 2056 },
...this.getLayerStyle('255,127,39')
});
mapView.map.add(layer);
return of({
layer: layer,
features: features
});
}

protected getLayerStyle(rgb?: string): __esri.FeatureLayerProperties {
return {
geometryType: 'polyline',
renderer: <__esri.SimpleRenderer>{
type: 'simple',
symbol: <__esri.Symbol><any>{
type: 'simple-line',
width: 12,
color: `rgba(${rgb ? rgb : '237,202,10'},0.6)`,
style: 'solid',
cap: 'butt'
}
},
labelsVisible: true,
labelingInfo: [<Partial<__esri.LabelClassProperties>>{
labelExpressionInfo: {
expression: `$feature.${xFields.name}`
},
labelPlacement: 'center-along',
symbol: {
type: 'text',
color: 'black',
haloColor: `rgba(${rgb ? rgb : '237,202,10'},1)`,
haloSize: 2,
yoffset: 12,
font: {
size: 11
}
},
deconflictionStrategy: 'none'
}],
opacity: 1
};
}

0 Kudos
ZaraMatheson
Esri Contributor

Thanks Reagan, Can you confirm that you are having issues printing from the Map Viewer Beta app or are you attempting to print from somewhere else? Just want to make sure we have the right people looking at this. 

0 Kudos
ReaganSenoron
New Contributor II

I am not sure what you mean.

The map is hosted in ArcGis server(in-house). 

We use portalItem to render the map on our application.

We added the Print widget on the map.

We use our own print rest service url.

0 Kudos
Noah-Sager
Esri Regular Contributor

We have a few known limitations with printing. Here is one that may apply to you:

  • Labels currently cannot be printed as part of a FeatureLayer with ArcGIS Server 10.5.1 or any Printing Service published with ArcMap.

To help diagnose the issue, it would be super helpful if you could provide link to a reproducible test case on something like Codepen if possible. Something like this: https://codepen.io/noash/pen/PoNJqOQ?editors=1000 

0 Kudos
Alber_Verster
Esri Contributor

Hi, 

I found that updating the Label field in the Legend section when configuring the Symbology, fixes the issue. 

For ArcMap 10.7.1: 

ArcMap 10.7.1

For ArcGIS Pro 2.6:

ArcGIS Pro 2.6

A re-publish of the layer would be required to make the changes stick to the Featuer service.

Hope this helps.

0 Kudos