AnsweredAssumed Answered

Configuring Custom Print Template in ArcGIS Pro for use through JSAPI?

Question asked by agelfert on Aug 13, 2019
Latest reply on Aug 14, 2019 by ahoque-esristaff

I have a need for a custom map layout when printing from JSAPI web map. But I haven't been successful in publishing a custom template in ArcGIS Pro that works when called using the Javascript API (JSAPI).

 

Using the Print widget with the regular PrintingTools, as shown in this ESRI sample, works fine:

 

var print = new Print({
      view: view,
      // specify your own print service
      printServiceUrl:"https://myserver.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task",
      container: document.createElement("div")
});

 

The widget open the window on the left and gives me all the default layout printing options. I would like to create a custom layout.

 

Next, I've followed the instructions here and here, to create a *.pagx layout file in ArcGIS Pro  (would be MXD in ArcMap) and share (publish) through Portal. The instructions read: 

...To create and share the web tool with ArcGIS Enterprise, the folder containing your layout templates must be accessible to ArcGIS Server. If the folder is accessible to the server, you can register it with the server; otherwise, copy the folder's contents to the server from ArcGIS Pro when you share the web tool.

So in steps 5 and 9, ...

5. For the Layout Templates Folder parameter, click the browse button and browse to the folder where your layouts are stored.

...

9. Choose the same Layout Templates Folder that you specified when running the Export Web Maptool in step 5

 

...I've left the field blank, and then checked "Copy all data" (Step 12) to copy the template to the server during Sharing. There are no errors during the sharing process. I get this and then ...

 

 

...see the item in Portal. When I reference the REST URL for the new print service in JSAPI...

 

var print = new Print({
      view: view,
      // specify your own print service
      printServiceUrl:"https://myserver.com/arcgis/rest/services/Custom_GP_Services/New_Custom_print_test/GPServer/Export%20Web%20Map",
      container: document.createElement("div")
});

 

I get this jocular bit of messaging:

 

 

Anyone seen this before? There are no JS errors in the console. So I have little to go on.

 

Troubleshooting at the print service REST page, as shown here, creates PDF output but it's not based on my custom template.

 

Output:

Outcomes