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 Server. 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 (MXDs) 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. See Registering your data with ArcGIS Server using ArcGIS Desktop to learn how to register a folder with the server.

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 ArcCatalog or the Catalog window in ArcMap, browse to Toolboxes > System 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 Server, 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 to run the tool.
  8. Browse in Toolboxes > System Toolboxes > Server Tools > Printing to the Get Layout Templates Info script tool and open it.
  9. The Get Layout Templates Info script tool is available beginning at 10.4. This 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 the active data 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. Click Geoprocessing > Results to display the Results window.
  12. Expand Current Session, right-click the ExportWebMap result, and click Share As > Geoprocessing Service.
  13. Choose Publish a service and click Next.
  14. Choose a connection to ArcGIS Server (or click the button to add a new one), give your service a name, and click Next.
  15. 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.

    When you have finished selecting a 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.

  16. Click Parameters 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 to be used with Portal for ArcGIS must be Synchronous.
  17. On the Service Editor, find the left panel where each tool parameter is listed (Web Map as JSON, Output File, Format, Layout Templates Folder, and Layout Template). Click each of these parameters 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.

  18. In the Service Editor, click Add Result and add the Get Layout Templates Info result from running the script tool.
  19. Use the Service Editor to set other properties you want for your service, such as the minimum and maximum number of instances that are allowed to run per machine.
  20. Click Publish 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.

  21. 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 Server

If you registered your layout templates folder with the server, this means the server can see your layouts. If you make updates to the MXDs 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 Server

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 ArcMap, 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 for print services used in Portal for ArcGIS

If you plan to use your print service in Portal for ArcGIS, 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 My 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 in the ArcGIS Desktop help for more information about creating effective page layouts.