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 new 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.
To make your own service for printing, you need to publish a geoprocessing service with the Export Web Map tool. This tutorial will guide you through this process.
Registering your layout templates folder with ArcGIS Server
During this tutorial, 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.
- In 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, Portal for ArcGIS 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.
Tip:
If you just 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 ArcGIS Desktop to run the tool.
- Browse in Toolboxes > Server Tools > Printing to the Get Layout Templates Info script tool and open it.
- Legend
- 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.
Caution:
Due to a known limitation with the Export Web Map tool, you cannot filter the parameter choices available to end users.
- Click Add Tool 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 Portal for ArcGIS, 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 "Registering your layout templates with ArcGIS Server").
Updating the layout templates folder if you registered it with ArcGIS Enterprise
If you registered your layout templates folder with the server, this means the server can see your layouts. If you make updates to the Layout Files (.pagx) in the folder, your modified layouts will be immediately available. If you add a new layout to the templates folder, you will need to restart the printing service before you can access and use the layout.
Updating the layout templates folder if you did not register it with ArcGIS Enterprise
If you did not register your layout templates folder with the server, the layouts were copied to the server at the time of publishing. You need to perform a service overwrite to update the templates on the server. Follow these steps to do the overwrite:
- In ArcGIS Desktop, 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.
- 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 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
If you plan to use your print service in your ArcGIS Enterprise portal, register your layout templates folder with the server to allow for quick updates to the print service layouts. Once you have updated a layout, restart the print service in order to propagate changes to the portal.
If you have added or removed a layout from the layout templates folder, you must restart the print service. After the service has restarted, go to Organization > Utility Services in the portal and click Refresh for the portal's print service. See Configure the portal to print maps in the Portal for ArcGIS Administrator Guide for more information.
There are several best practices to follow when you create layouts in ArcMap that will be used in a portal:
- Anchor the upper left corner of the legend in the layout so it remains fixed in this location when printed in the 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 full name of the user logged in to the portal.
- 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.
- The Date Saved dynamic text will also display the time the map was printed.
Caution:
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.