Printing in web applications

Printing a map from a web application presents a number of challenges, which include merging multiple services, maintaining layer visibility settings, adding items to the layout, and drawing graphics on top of the map. To help you with these challenges, ArcGIS Server includes a geoprocessing service called PrintingTools. When you develop your web applications, you can invoke the PrintingTools service and get a printable image of high cartographic quality in return. For advanced printing, you can use a Python script to convert the web map into an ArcMap document (MXD), and in turn export the MXD to a variety of formats for printing.

The PrintingTools service

PrintingTools is a preconfigured service in the Utilities folder. This service is stopped by default. You must use ArcGIS Desktop or ArcGIS Server Manager to start the service if you want to support printing workflows.

The PrintingTools service is intended to be used in web apps in conjunction with the ArcGIS web APIs. The ArcGIS web APIs offer widgets that can communicate with the PrintingTools service to get a printable map. You provide the URL of the PrintingTools service and the widgets do the rest of the work.

PrintingTools comes with a predefined set of map layouts to choose from. If you want to use your own map layouts, you can publish your own service for web map printing similar to PrintingTools and point it at your own folder of layouts. See Using your own layouts for printing and Tutorial: Publishing additional services for printing if you want to learn more about this.

When your map service is cached, the PrintingTools service may use a resolution that is too low (for example, 96 DPI) for large format or high quality printing. To print at higher resolutions, it is recommended that you enable dynamic layers on your cached map service. This allows the print service to obtain map images (through an export map request) at the desired resolution (for example, 300 DPI) instead of the lower resolution tiles. To learn more, see About dynamic layers.

Advanced printing using Python

For advanced printing scenarios, you do not use PrintingTools at all; rather, you can use the ConvertWebMapToMapDocument function in the Python arcpy.mapping module included with ArcGIS. When the document is converted, the full web map exists in the map document. The map document can then be further modified before finally being printed or exported to a common format such as PDF.

The ConvertWebMapToMapDocument function is commonly used to replace service layers with local vector data, create map books, control the appearance of the legend, and export different formats using advanced options.

To make your Python script available to a web application, you can expose the script through an ArcGIS Server geoprocessing service. See Advanced printing for web maps to learn more.