Skip To Content

Tutorial: Publishing additional services for printing

Complexity: IntermediateData Requirement: Use your own data

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) or Layout Files (.pagx) 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.

  1. In the Geoprocessing tab, browse to Toolboxes > Server Tools > Printing.
  2. Double-click the Export Web Map tool to open it.
  3. 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.

  4. 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.
  5. 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.

  6. 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.
  7. Click OK in ArcGIS Desktop or Run in ArcGIS Pro to run the tool.
  8. Browse in Toolboxes > Server Tools > Printing to the Get Layout Templates Info script tool and open it.
  9. 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:

    • Legend
    • Title text
    • Copyright text
    • Author text
    • Custom text elements

  10. 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.
  11. In the Share tab on the ribbon, click on Geoprocessing and pick the Export Web Map result.
  12. 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.
  13. Switch to the Configuration tab and ensure the Execution Mode of the service under the Parameters section 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.
  14. 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.

  15. Click Add Tool and add the Get Layout Templates Info result from running the script tool.
  16. 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.

  17. Verify that your service published correctly by browsing to it in Manager or the Services Directory.

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:

  1. In ArcGIS Desktop, open the Export Web Map tool and run it using your desired default values as described in the previous section.
  2. Right-click the geoprocessing result and choose Share As > Geoprocessing Service.
  3. Choose the option Overwrite an existing service and click Next.
  4. Click the name of the service you want to overwrite and click Continue.
  5. 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.

Considerations when preparing ArcGIS Pro layouts for use with ArcGIS Enterprise

When you create layouts in ArcGIS Pro to be used in an ArcGIS Enterprise portal, consider the following.

  • When creating a map frame template, usually leave the associated map empty. In some advanced cases, you might have layers in the map.
  • When you have more than one map frame in a layout, you need to name one "WEBMAP_MAP_FRAME." The printing service updates the map associated with this map frame.
  • You can optionally insert a Legend element, and set properties to Default Legend Item to set styles for legend items, such as font family and line spacing.
  • Insert dynamic text elements to automatically update titles, author names, or any other information when you change them in the map document, following this format:

    Text elementDynamic text input

    Title

    <dyn type="layout" property="metadata" attribute="title" emptyStr=""/>

    Credits

    <dyn type="layout" property="metadata" attribute="credits" emptyStr=""/>

    Author

    <dyn type="layout" property="metadata" attribute="contactname" emptyStr=""/>

  • Add custom text elements to show any information. To do so, format a text element between curly braces, such as {Town Name} or {Parcel Address}.

See Layouts in ArcGIS Pro for more information about creating effective page layouts.

Related topics