Select to view content in your preferred language

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

6866
10
Jump to solution
08-13-2019 03:03 PM
Arne_Gelfert
Regular Contributor

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:

0 Kudos
10 Replies
TanuHoque
Esri Regular Contributor

In a print service created from ArcMap, I just need to add a template mxd to the registered folder and stop and start the service for a new template to show up.

@MichaelVolz I believe that only works for the print service that comes out of the box when you install ArcGIS Server/Enterprise prior to 10.6.1 release.

When you publish a new print service from ArcMap, the template names get burnt into the service - therefore adding a new mxd in the Layout Template Folder won't make print service pick up new templates. You need to republish.

Only time you won't need to republish is when you update an existing .mxd and the service is published by reference (i meant when mxd files don't get copied to the server during publishing process).

 


In a print service created from Pro, do I really need to republish the service to see a new pagx template in the registered folder as opposed to just stopping and starting the custom print service?

Yes, that is true.

 

 

 

 

0 Kudos