There may be occasions when you need to publish additional services for web printing beyond the PrintingTools service included with ArcGIS Enterprise. For example, you could create a service and configure it to point at your own folder of map layouts. Or you could publish one freely available service while making a more advanced service available for a fee.
You should not update the layouts that come with the default PrintingTools service, nor add new layouts and republish this service. To make your own service for printing, you need to publish a geoprocessing service with the Export Web Map tool.
To view the equivalent workflow of this tutorial in ArcGIS Pro, see Share a print service web tool with custom layouts from ArcGIS Pro.
Registering your layout templates folder with ArcGIS Server
You will work with a folder of ArcMap documents (.mxd) you have prepared that contain different layouts to be used for web map printing. This is your layout templates folder.
If your layout templates folder is currently on the server or accessible by the server, you should register the folder with ArcGIS Server using ArcGIS Desktop.
If you cannot get your layout templates folder onto the server or into a location accessible by the server, do nothing. The layout templates folder will be copied to the server at the time you publish the service, thereby ensuring the server can see the folder. Although this option is easier to configure, it takes more steps to update your layout templates in the future.
Preparing and publishing the service
The first step in publishing is to run the Export Web Map tool with the default values you want for your service. Next, you will run the Get Layout Templates Info script tool. You will then publish the results as a geoprocessing service.
- On the Geoprocessing tab, browse to Toolboxes > Server Tools > Printing.
- Double-click the Export Web Map tool to open it.
- Leave the Web Map as JSON parameter blank.
To get printable images, users of this service will submit their own web map JSON for this parameter. The printing widgets in the ArcGIS Web APIs, ArcGIS Enterprise app templates, and Web AppBuilder for ArcGIS do the work of generating this JSON behind the scenes.
- Leave the default for the Output File parameter. Once you publish this tool to the server, the output will be placed in the server jobs directory.
- Supply the Layout Templates Folder parameter by clicking the browse button and browsing to the folder where your layouts are stored.
If you only want to reference the basic layouts installed with ArcGIS Enterprise, leave this parameter blank.
- Optionally set the Layout Template parameter by choosing one of the layouts from the drop-down list. This will be the default layout when users run your service.
- Click OK in ArcMap to run the tool.
- Browse to Toolboxes > Server Tools > Printing to the Get Layout Templates Info script tool and open it.
- Title text
- Copyright text
- Author text
- Custom text elements
- Choose the same Layout Templates Folder that you specified when running the Export Web Map tool in step 5 and click OK to run the script.
- Click Geoprocessing > Results to display the Results window.
- Expand Current Session, right-click the Export Web Map result, and click Share As > Geoprocessing Service.
- Choose Publish a service and click Next.
- Choose a connection to ArcGIS Server (or click the button to add a new one), give your service a name, and click Next.
- Choose the folder where this service will reside. You cannot publish into the existing System or Utilities folders. You must use your own folder or the root folder. Click Continue.You are now viewing the Service Editor, where you can do more preparatory work before publishing, such as setting available parameter choices for your service.
- ClickParameters and ensure the Execution Mode of the service is set to Synchronous. You can alternatively choose Asynchronous if you expect the requests to take more than a few seconds. Print services used in the ArcGIS Enterprise portal must be Synchronous.
- Click each parameter and examine the defaults that are set. If you want to change the defaults, you need to go back to the Export Web Map tool dialog box and set the values there, as you did in the previous steps in this tutorial. You can hide a parameter completely from end users and force them to use the default by setting the parameter's Input mode to Constant value.
Due to a known limitation with the Export Web Map tool, you cannot filter the parameter choices available to end users.
- Click Add Result and add the Get Layout Templates Info result from running the script tool.
- Click Share to publish your service.
If you receive a warning about data being copied to the server, click OK. This just copies the default output image, which is not a significant amount of data.
- Verify that your service published correctly by browsing to it in Manager or the Services Directory.
The Get Layout Templates Info script tool allows you to add the Get Layout Templates Info task to print services. The task provides the size of the layout page and the size of a map frame. It also shows whether the following layout elements are available:
Your new service can now be referenced in the printing widgets offered by the ArcGIS web APIs. The URL for the print service can be found in your ArcGIS Services directory.
To use the custom print service with the ArcGIS Enterprise portal, copy this URL, including the Export Web Map task, and paste it in the Utility Services dialog box for Printing. Note that the portal will only accept a URL that uses HTTPS for its print utility service.
Updating the layout templates
If you want to update the layouts in your layout templates folder, the appropriate workflow is determined by whether you registered the layout templates folder with the server before publishing (see the "Registering your layout templates with ArcGIS Server" section above). It also matters whether you want to add a new layout to the folder or update an existing layout. This is because the geoprocessing task you created keeps a list of the layouts that were in your layout template folder at execution time.
If you registered your layout templates folder with the server before publishing, this means the server can see your layouts. If you make updates to existing layout files (.pagx) in the folder, your modified layouts will be immediately available. However, the server will not see any new layouts you add after publishing the service.
Accordingly, if either of the following are true, you will need to perform a service overwrite for your changes to be available to your ArcGIS Server users:
- You did not register your layout templates folder with the server prior to publishing your custom print service, meaning the layouts were copied to the server at the time of publishing.
- After publishing your custom print service, you want to add a new layout template to the folder and make it available to your users.
Overwrite and republish your custom print service
Follow these steps to overwrite the service and make your updates available:
- In ArcMap, open the Export Web Map tool and run it using your desired default values as described in the previous section.
- Right-click the geoprocessing result and choose Share As > Geoprocessing Service.
- Choose the option Overwrite an existing service and click Next.
- Click the name of the service you want to overwrite and click Continue.
This should be a custom print service you have published, not the default PrintingTools service.
- On the Service Editor, verify that all the service properties are set to your liking (they should default to the properties you chose when you originally published the service) and click Publish.
The options that you choose overwrite all options set during the first publishing. The layout templates folder (including your updates) are copied to the server and replace the layout templates folder that was put there when you originally published the service.
Considerations when preparing ArcMap print services for use with ArcGIS Enterprise
There are several best practices to follow when you create layouts in ArcMap that will be used in an ArcGIS Enterprise portal:
- Insert a Title and leave the title text blank to allow the name of your portal web maps to populate in the title text box when printed. A web map that has not been saved will print with the title My Map.
- Insert the Author dynamic text to print the name of the user.
- Insert the Current Date dynamic text to display the date the map was printed.
- Insert the Current Time dynamic text to display the time the map was printed.
Do not insert the User Name dynamic text into the layout. This dynamic text will populate with sensitive information about the print service.
See A quick tour of page layouts for more information about creating effective page layouts.