This example
https://developers.arcgis.com/javascript/latest/sample-code/widgets-print/
In the layer, some layers are hidden in the list,
When Output PDF still display,
Can control the legend Individual display?
Hi @Wade, are you talking about hidden layers displaying in the printed legend? If so, this is a known issue that was recently fixed. You can see the fix now using next, or wait for 4.22 to release (which should be later this week).
next: https://github.com/Esri/feedback-js-api-next
@Wade, quite welcome. Feel free to mark my post as the solution if you feel it answered your question.
Hi @Noah-Sager
Thank you for providing information.
Hi @Kishore
The question is, There are two layer inside, One does not display in the list,
When Output PDF still display, Can control the legend Individual display?
<html> <head> <meta charset="utf-8" /> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no" /> <title>Print widget | Sample | ArcGIS API for JavaScript 4.21</title> <link rel="stylesheet" href="https://js.arcgis.com/4.21/esri/themes/light/main.css" /> <style> html, body, #viewDiv { padding: 0; margin: 0; height: 100%; width: 100%; overflow: hidden; } .esri-zoom { display: none; } </style> <script src="https://js.arcgis.com/4.21/"></script> <script> require([ "esri/views/MapView", "esri/Map", "esri/layers/FeatureLayer", "esri/layers/MapImageLayer", "esri/widgets/LayerList", "esri/widgets/Print", ], ( MapView, Map, FeatureLayer, MapImageLayer, LayerList, Print ) => { const map = new Map({ basemap: "topo-vector" }); const view = new MapView({ container: "viewDiv", map: map, extent: { xmin: -9177811, ymin: 4247000, xmax: -9176791, ymax: 4247784, spatialReference: 102100 } }); const featureLayer = new FeatureLayer({ url: "https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Landscape_Trees/FeatureServer/0", listMode: "hide" }); const mapImageLayer = new MapImageLayer({ url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer" }); map.add(featureLayer); map.add(mapImageLayer); view.when(() => { const print = new Print({ view: view, printServiceUrl: "https://utility.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task" }); const layerList = new LayerList({ view: view }); view.ui.add(print, "top-right"); view.ui.add(layerList, "top-left"); }); }); </script> </head> <body class="calcite"> <div id="viewDiv"></div> </body> </html>
@Wade By default Print widget in JS API honors only the visible layers. I tested the sample and it is working fine. please check the screenshots Sandbox app with displaying he legends:
and the print generated from the app:
If you can provide more details on the requirements we can check.
サインインしたメンバーは投稿、更新のフォローなどができます。初めてですか?無料アカウントを登録してください。
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.