There are several ways to generate a printable document from a web application. ArcGIS Enterprise includes a geoprocessing service called PrintingTools. Web applications invoke the PrintingTools service and get a printable document in return. You can also create a custom print service using your own layouts rather than those in the default PrintingTools service. For advanced printing, you can use a Python script to convert the web map into an ArcMap document (.mxd) or ArcGIS Pro Project (.aprx), then export the map or layout inside the project to a variety of formats for printing.
Printing can be configured for the ArcGIS Enterprise portal, web app templates, Web AppBuilder for ArcGIS, and for applications created using the ArcGIS web APIs. See Configure the portal to print maps in the Portal Administrator Guide for more information about providing your portal, including any applications created with Web AppBuilder or web app templates, with printing capabilities.
The PrintingTools service
PrintingTools is a preconfigured service in the Utilities folder that creates a printable document using one of a set of predefined map layouts. These include basic designs using 8.5 by 11 inch, 11 by 17 inch, A3, and A4 paper sizes in both portrait and landscape orientations. Each layout contains a north arrow, scale bar and ratio, legend, date, and title. The supported output formats from the PrintingTools service are PDF (georeferenced), PNG32, PNG8, JPG, GIF, EPS, SVG, and SVGZ.
The PrintingTools 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. Once the PrintingTools service has started, you can access it using a URL with the following format: https://webadaptorhost.domain.com/webadaptorname/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task.
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. For more information on using the PrintingTools service with your ArcGIS Enterprise portal, see Configure the portal to print maps.
Note:
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.The Get Layout Templates Info 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:
- Legend
- Title text
- Copyright text
- Author text
- Custom text elements
You can also add this task to custom print services. For instructions, see Tutorial: Publishing additional services for printing.
Note:
It is not recommended to use your own layout templates with the PrintingTools service. Instead, you should publish a custom print service.
Legends
Whether you use PrintingTools or a custom print service, the legends in your printed output will behave similarly. When printing feature services, the legend in the printed document will only include legend entries for the features found in the map extent, whereas legends for other service types will include all of the legend entries for the features regardless of the map extent.
Unicode characters
The default layout templates in the PrintingTools service do not use fonts supporting Unicode characters. You may thus run into issues with titles or legend items, specifically with international characters. To remedy this, consider publishing a custom print service using your own layout templates, and set a font that supports Unicode characters:
- While working with the legend element in ArcGIS Pro, you can set a font supporting Unicode characters for the default legend item.
- ArcMap does not support changing the font of the default legend item. Therefore, you need to write an arcpy-based printing service to change the style for all items in a legend element.
Custom print services
If you want to use your own map layouts, you can publish your own service for web map printing similar to PrintingTools. This can be done from ArcMap 10.1 and later, or from ArcGIS Pro 2.1 and later. You configure this service to reference your own folder that you've prepared with various map layouts — a Map Document (.mxd) in ArcMap or Layout Files (.pagx) in ArcGIS Pro.
You can find instructions to publish your own custom tools for printing in two topics: Publish an additional print service with custom layouts from ArcMap and Share a print service web tool with custom layouts from ArcGIS Pro. In the ArcGIS Pro workflow, you share a web tool to your ArcGIS Enterprise portal, which is powered by a geoprocessing service published to a federated ArcGIS Server site.
These workflows also explain what to do if you later decide you want to update your layouts. Your update approach will vary based on whether or not you registered your layouts folder with the server before publishing, and the workflows contain instructions for both scenarios.
Note that there are additional considerations in these topics for publishing and consuming custom printing tools in your ArcGIS Enterprise portal. The custom print service must be published as a synchronous geoprocessing service and the URL for the print service must use HTTPS for the portal to accept it as the portal's print service. For more information on using a custom print service or web tool in your ArcGIS Enterprise portal, see Configure the portal to print maps.
Custom print services can print layouts that use multiple map frames or data frames.
- Print services published from ArcMap update contents in the active data frame.
- Print services published as part of a web tool from ArcGIS Pro update the map associated with the map frame you have named "WEBMAP_MAP_FRAME" (case sensitive).
Note:
It is recommended to remove all layers from the map associated with the "WEBMAP_MAP_FRAME". However, in some advanced cases, you might need to have layers in the map, and the printing service does not remove them.
Advanced printing using Python
For advanced printing scenarios, you do not use PrintingTools at all. Rather, you can use the ConvertWebMapToMapDocument (for ArcMap) or ConvertWebMapToArcGISProject (for ArcGIS Pro) functions in the Python arcpy module. When the document is converted, the full web map exists in the map document (.mxd) or ArcGIS Pro Project (.aprx). The map document, or the map or layout in the ArcGIS Pro Project, respectively, can then be further modified before finally being printed or exported to a common format such as PDF.
These convert functions are 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.