Select to view content in your preferred language

Help with Dynamic Logo and Text in Custom Web Print Layout for JS4 web app

707
0
07-02-2021 09:05 AM
MikeGarcia
New Contributor II

I know there has to be other's who've done this before. 
I am trying to add a Custom Print Layout to a JavaScript 4.18 app and cannot get the layout to dynamically change the Title and Logo, everything else works as expected.  

The dynamic fields come from Hosted Feature layers, Enterprise 10.8.1  

The app is based off the Edit features with the Editor widget | ArcGIS API for JavaScript

We would like users to have the ability to print the lines and polygons they just created to a custom layout, and they want to see their own logo in the export.  

I created a web map for the app and built the dynamic layout from two features in the Web map.

There is a "picture" logo (png) that is supposed to update according to an arcade expression in the Format Picture options. ("https://gisserver.com/logos/" + $feature.logo + ".png")- it works in Pro.  

The Title is based on 4 attribute fields from one feature service.  ("AGREEMENT:  " + $feature.agreement_id + TextFormatting.NewLine
+ $feature.city + ", " + $feature.state + TextFormatting.NewLine
+ "CUSTOMER: " + $feature.customer)- works in Pro.  

I also have a table that dynamically updates according to the visible features, but comes from a second layer.  - this works in Pro and also in the print service. 

After Publishing it and consuming it through the rest endpoint, the map elements (Legend, scalebar, north arrow, even the table) update, but the logo becomes static and the title is empty.  It doesn't even display the non-dynamic, hard-coded text.  (i.e. "CUSTOMER: " + $feature.customer)

After struggling with it, I found this Help on Print Dynamic Text from a Web Application

I did not complete it exactly because I am not using WAB, but I was not able to get the Logo, nor title to update.  It seemed to work the same as the default "Export Web Map" and "Get Layout Templates Info" tools.  

Now I am considering two routes but am open to other options: 

1. Do I try to use a Python script to modify the Layout elements, like in this example - Dynamic Layout Title (ArcGIS Pro),  I don't think this will work exactly because my features are hosted and would not be in the "Stagged vector layers", but I am not 100% on this theory.  Also seems very inefficient to go through Pro just to add an image to a pdf.  

2.  Could the Logo and title possibly be handled by the JavaScript using PrintTemplate options and customTextElements?  i.e. Logo, title?  

 

0 Kudos
0 Replies