Skip To Content

Share custom layouts for printing from ArcGIS Pro

When you need printing capabilities in ArcGIS Enterprise outside the scope of the default PrintingTools service, you can create custom layouts in ArcGIS Pro. You can either share these layouts to your portal as a web tool or publish them to a stand-alone ArcGIS Server site as a geoprocessing service. Geoprocessing services that enable printing are called print services.

Do not update the layouts that come with the default PrintingTools service, and do not add new layouts and republish this service. Instead, run the Export Web Map script tool in ArcGIS Pro and share the result, serving as an additional resource for web map printing.

If you share a web tool to the portal, the result of this tutorial will be shared to the ArcGIS Enterprise portal where you're signed in, and the print service that underlies the web tool will be saved to the federated ArcGIS Server you designate.

If you are working with a stand-alone server site, the result of this tutorial is a print service based on the Export Web Map and Get Layout Templates Info tools you run in ArcGIS Pro.

Create a custom layout

If you want to create a custom layout template, you can do so in ArcGIS Pro. See Layouts in ArcGIS Pro for information. Save the layout to a folder: On the Share tab, in the Save As group, click Layout File. Alternatively right-click the layout in the Catalog pane and choose Save As Layout File.

Note:

To support custom layouts authored in ArcGIS Pro 3.0 and later versions, your organization must be using a version of ArcGIS Server that is either at 11.0 or later.

Prepare layouts

There are several best practices to follow when you create layouts in ArcGIS Pro that will be used in an ArcGIS Enterprise portal:

  • If you have more than one map frame in your layout, identify the map frame you want the web tool to use and name it WEBMAP_MAP_FRAME (case sensitive). The print service will use the map frame named such.
  • Insert dynamic text such as title, author name, and so on. To learn more about dynamic text, see What is dynamic text? in the ArcGIS Pro documentation. To insert dynamic text, complete the following steps:
    1. From the Insert tab of the ribbon, select the Text command in the Text group.
    2. Click a location on the layout to position the new text element.
    3. Open the Property page for the text element.
    4. Insert one of the following tags into the selected element's Text property:

      titleText

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

      authorText

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

      copyrightText

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

      You can only add one dynamic text tag per text element.

  • You can also add the Current Time dynamic text element from the System category in the Dynamic Text drop-down menu. This is also located in the Text group of the Insert ribbon.
  • To insert a custom text element, add a text element and embed the element's name in a set of open and closed curly braces, such as {parcel-id}.
  • If you insert a scale bar, it's recommended that you select the Compute at center option, which calculates the map scale using the center of the map frame rather than a location along the equator. This option is not recommended for your scale text (such as 1:3,000).
  • Introduced at 11.2, you can also add attributes and statistics as dynamic text elements to your layouts.
Caution:

Do not insert the User dynamic text into the layout. This dynamic text will populate with sensitive information about the print service.

Register the layout templates folder with ArcGIS Server

The folder containing your layout templates must be accessible to ArcGIS Server (either a server that's federated with your portal or a stand-alone server). If the folder is accessible to the server, you can register it with the server; otherwise, copy the folder's contents to the server from ArcGIS Pro when you share your web tool or publish your print service.

See Manage registered data stores in the ArcGIS Pro help for instructions.

Prepare custom tools

When you're ready, run the Export Web Map script tool using the folder containing your custom layout templates. Next, run the Get Layout Templates Info script tool, referencing the same folder.

  1. In the Geoprocessing pane, 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 as #.

    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, ArcGIS Enterprise app templates, and ArcGIS Web AppBuilder generate this JSON.

  4. Leave the Output File parameter as is.

    Once you publish this tool to the server, the output is placed in the server jobs directory.

  5. For the Layout Templates Folder parameter, click the browse button and browse to the folder where your layouts are stored.
    Tip:

    If you only want to reference the basic layouts installed with ArcGIS Enterprise, leave this parameter blank.

  6. Optionally, choose a layout from the Layout Template drop-down list.

    This will be the default layout when users run your service.

  7. Click Run to run the tool.
  8. Browse to Toolboxes > Server Tools > Printing and double-click the Get Layout Templates Info script tool to 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 folder for Layout Templates Folder that you specified when running the Export Web Map tool in step 5. Click Run to run the script.

Now that you have run the two geoprocessing tools with your custom layouts, you can share the results to ArcGIS Enterprise. The workflow you follow next depends on whether you are working with an ArcGIS Enterprise portal (with one or more federated server sites) or a stand-alone server site.

Use custom print templates in the ArcGIS Enterprise portal

You can upload Layout templates (.pagx) and Report templates (.rptt) as portal items that can be passed to individual print services. Follow these steps to upload a custom print template:

  1. Create a Layout or Report template in ArcGIS Pro.
  2. Save the template as either a .pagx or .rptt file.
  3. Sign in to your portal.
  4. Click Content.
  5. Click New item.
  6. Either drag and drop your template file or click Your device and select the file.

Your template is now able to be passed to print services via the Layout_Item_ID and Report_Item_ID parameters.

For more information, see the Create a custom report template and Layout files topics.

Limitations

The following limitations exist when using custom print templates:

  • Items must be in the same portal where the print services server is federated. For example, a print service running on portal A cannot access an item from portal B.
  • The default print services of the out of the box print service and ArcGIS GIS Server do not support this capability.
  • Web clients do not currently support this capability. Instead, you must write a custom Javascript API.

Publish a print service to ArcGIS Enterprise portal to enable reports

Introduced at 11.2, you can publish print services from ArcGIS Pro 3.2 or later to enable the printing of reports based on Layout templates (.pagx), Report templates (.rptx), or both.

Types of reports

There are three types of reports you can generate through a print service:

  • Layouts with dynamic text elements — A single page output that includes a map and attributes and statistics displayed through dynamic text elements.
  • Reports with no maps — A multi-page output that can include attributes, statistics, charts, and attachments. Only supports a PDF format.
  • Layouts with or without dynamic text elements and a report — A multi-page output that includes both a Layout and a Report. Only supports a PDF format.

Publish a report

To publish a report, follow the steps below:

  1. Create a Layout with dynamic text elements or a Report template in ArcGIS Pro.
  2. Save the template as either a Layout (.pagx) or Report (.rptx) template in your template file folder.
  3. In ArcGIS Pro, open the Export web map tool.
  4. Set the Layout Templates Folder parameter to the template file folder you saved your template to.
  5. Run the Export web map tool.
  6. Browse to Toolboxes > Server Tools > Printing and double-click the Get Layout Templates Info or Get Report Templates Info script tools, depending on whether you are publishing Layouts, Reports, or both.
  7. Publish your templates as a Print service.

Limitations

The following limitations exist when using reports:

  • The default print services of the out of the box print service and ArcGIS GIS Server do not support this capability.
  • Map Viewer and ArcGIS Experience Builder do no support this capability.
  • Web clients do not currently support this capability. Instead, you must use the Javascript API to create a custom app or widget.

Share a printing web tool to the ArcGIS Enterprise portal

If you work with an ArcGIS Enterprise portal, follow these steps to share the geoprocessing tool results to the portal as a web tool:

  1. On the Analysis tab on the ribbon, click History, or click the History tab in the Catalog pane. Right-click the Export Web Map result, and choose Share As > Web Tool.

    The Share As A Web Tool dialog box appears.

  2. Use the Analyze option to identify any possible issues.
  3. On the General tab of the dialog box, replace the defaults in Item Details (name, summary, and tags) as necessary. If you registered the layout templates folder with the server as described above, choose the Reference registered data option; otherwise, choose Copy all data. Designate the portal folder where you want the web tool saved and the federated ArcGIS Server site and server folder where you want its underlying geoprocessing service saved. Then, set the sharing options for this web tool.
  4. Switch to the Configuration tab. Specify an Execution Mode option for the tool in the Parameters section. In most cases, choose Synchronous. Choose Asynchronous if you expect requests to the tool to take more than a few seconds (such as when printing a large, detailed map). Then, set a logging Message Level value for the tool.
  5. Switch to the Content tab. Click Add Tool and add the Get Layout Templates Info result.

    Both of the tools you ran are now incorporated into this web tool.

  6. Click Share to share the web tool.
  7. Verify that your web tool published correctly.

    The web tool is available in your ArcGIS Enterprise portal, and its underlying geoprocessing service is available in ArcGIS Server Manager.

Your new web tool can now be referenced in the printing widgets offered by the ArcGIS web APIs, as well as in the portal Map Viewer. The URL for the web tool is available from its item page in the ArcGIS Enterprise portal.

The web tool is powered by a custom print service in your federated ArcGIS Server site. You can designate this service as your ArcGIS Enterprise portal's printing service. Open ArcGIS Server Manager and locate the service, then copy its URL including the Export Web Map task, and paste it in the Utility Services dialog box for Printing.

Publish a print service to the stand-alone server

If you work with a stand-alone ArcGIS Server site that is at 10.6 or later, you can publish a print service from ArcGIS Pro to the server using the following steps.

  1. Add an administrator connection to the ArcGIS Server site.

    The connection must be an administrator connection to publish geoprocessing services to the stand-alone server.

  2. In the Catalog pane, right-click the server connection and choose Publish. Use the Geoprocessing Service option to launch the Selected History Item(s) window. Select the Export Web Map item from the list to launch the Publish Geoprocessing Service window.
  3. Use the Analyze option to identify any possible issues.
  4. On the General tab of the dialog box, replace the defaults in Item Details (name, summary, and tags) as necessary. If you registered the layout templates folder with the server as described above, choose the Reference registered data option; otherwise, choose Copy all data. Designate the server folder where you want its underlying geoprocessing service saved. Then, set the sharing options for this web tool.
  5. Switch to the Configuration tab. Specify an Execution Mode option for the tool in the Parameters section. In most cases, choose Synchronous. Choose Asynchronous if you expect requests to the print service to take more than a few seconds (such as when printing a large, detailed map). Then, set a logging Message Level value for the tool.
  6. Switch to the Content tab. Click Add Tool and add the Get Layout Templates Info result.

    Both of the tools you ran are now incorporated into this print service.

  7. Click Publish to begin publishing the print service.
  8. Verify that your print service published correctly.

    It is available in ArcGIS Server Manager.

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 register the custom print service with an ArcGIS Enterprise portal, 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.

Update 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 sharing (see the Registering your layout templates with ArcGIS Server section above). It also matters whether you want to add a layout to the folder or update an existing layout. This is because the geoprocessing task you created keeps a list of the layouts that were in your layout template folder at run time.

If you registered your layout templates folder with the server before sharing, this means the server can see your layouts. If you update existing layout files (.pagx) in the folder, your modified layouts will be immediately available. However, the server will not see any new layouts you add after sharing.

Accordingly, if either of the following are true, you will need to redo the workflow above and share a new web tool or print service for your changes to be available to your ArcGIS Server users:

  • You did not register your layout templates folder with the server prior to sharing the web tool or print service, meaning the layouts were copied to the server at the time of publishing.
  • After sharing the web tool or print service, you want to add a new layout template to the folder and make it available to your users.