Select to view content in your preferred language

Print Widget Legend and Print Area questions JavaScript API 4.x

146
2
Jump to solution
10-09-2024 06:11 AM
MarkSmith
Occasional Contributor

I’ve started to use the Print Widget in a JavaScript API 4.30 application.  I have successfully published a custom printing service in my ArcGIS Server (11.1) and I can publish Pro Layouts to it and use these in the Widget, all good besides two issues I don’t seem to be able to resolve.

  1. The widget comes with a ‘Show print area’ button.  When I configure the widget to use the out-the-box print service in the Utilities for ArcGIS Server (Utilities/PrintingTools/GPServer), it comes with a few pre-configured layout templates like A4 Landscape, and when I select these in the widget, the print area is highlighted on the map (by greying out the surrounding map).  This is great, but when I change the widget to use my custom print service with my layout templates, the ‘Show print area’ does not work.  I can just make out a dashed line around the very edge of my map area, so it looks like it’s trying to work, but it isn’t showing me the correct extent that comes out on the print export.  Does anyone know what I’m missing?  Is there some setting in the Pro layout design I need to input so the widget can work out the extent of the layout map frame?  I’ve tried publishing layouts both without and with a map that has a coordinate system set in case that was it, but it doesn’t help.
  1. The other issue I have is with the way the widget builds the legend on my print layouts.  My JavaScript API 4.x application has a MapView containing a map comprising a cached map basemap service and then a dynamic map service of layers the user can tick on and off.  The legend on the layout is displaying visible layers from the dynamic map service as it should, but also all the layers that make up the background cached map.  I need a way to stop the legend from building all the background cached map layers (of which there are dozens that make up the design of the pretty background map), so is there a property of the widget I can set to specify which services to include or exclude?  How can I just get the legend to build the visible layers in the dynamic map service only and ignore the background map?

Thank you,

Mark.

0 Kudos
1 Solution

Accepted Solutions
Sage_Wall
Esri Contributor

Hi @MarkSmith ,

To disable a MapImageLayer from being displayed in the Legend you can set the legendEnabled property to false on the layer.  I'm not sure about the print area I have very little experience in that area.

View solution in original post

2 Replies
Sage_Wall
Esri Contributor

Hi @MarkSmith ,

To disable a MapImageLayer from being displayed in the Legend you can set the legendEnabled property to false on the layer.  I'm not sure about the print area I have very little experience in that area.

MarkSmith
Occasional Contributor

That worked great, thank you - I was looking at the Print Widget and Layout functionality to solve this, hadn't occurred to me to look at the map layer properties to control a Layout legend.

0 Kudos