When you need printing capabilities in ArcGIS Enterprise outside the scope of the default PrintingTools service, you can create custom layouts in ArcGIS Pro that meet your needs. You can either share these layouts to your portal as a web tool or publish them to your stand-alone ArcGIS Server site (if you're using one) as a geoprocessing service. Geoprocessing services that enable printing are called print services.
You should not update the layouts that come with the default PrintingTools service, nor add new layouts and republish this service. Instead, you should 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.
This topic is similar to Publish a print service with custom layouts from ArcMap. However, that topic uses ArcMap to publish a print service to your server, whether it is stand-alone or federated with a portal. This topic uses ArcGIS Pro to either share a web tool with your portal or publish a print service to your stand-alone server.
Creating 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 your new 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.
Considerations when preparing your 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 do so:
- From the Insert tab of the ribbon, select the Text command in the Text group.
- Click on a location on the layout to position the new text element.
- Open the Property page for the text element.
- 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=""/>
- You can also add the Current Time dynamic text element from the System category in the Dynamic Text drop-down. This is also located in the Text group of the Insert ribbon.
- If you want 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 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).
Caution:
Do not insert the User dynamic text into the layout. This dynamic text will populate with sensitive information about the print service.
Registering your 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 your 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 your 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.
- In the Geoprocessing pane, browse to Toolboxes > Server Tools > Printing.
- Double-click the Export Web Map tool to open it.
- 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 Web AppBuilder for ArcGIS generate this JSON.
- Leave the Output File parameter as is.
Once you publish this tool to the server, the output is placed in the server jobs directory.
- 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.
- Optionally choose a layout from the Layout Template drop-down list.
This will be the default layout when users run your service.
- Click Run to run the tool.
- Browse to Toolboxes > Server Tools > Printing and double-click the Get Layout Templates Info script tool to open it.
- Legend
- Title text
- Copyright text
- Author text
- Custom text elements
- Choose the same Layout Templates Folder that you specified when running the Export Web Map tool in step 5. Click Run to run the script.
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:
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.
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:
- 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.
- Use the Analyze option to identify any possible issues.
- 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.
- Switch to the Configuration tab. Specify an Execution Mode for the tool in the Parameters section. In most cases, you'll 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 for the tool.
Note:
Print services that have an Execution Mode of Asynchronous cannot be used in Web AppBuilder for ArcGIS apps. - 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.
- Click Share to share the web tool.
- Verify that your web tool published correctly; it should be available in your ArcGIS Enterprise portal, and its underlying geoprocessing service should be 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.
- 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.
- 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.
- Use the Analyze option to identify any possible issues.
- 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.
- Switch to the Configuration tab. Specify an Execution Mode for the tool in the Parameters section. In most cases, you'll 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 for the tool.
- 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.
- Click Publish to begin publishing the print service.
- Verify that your print service published correctly. It should be 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.
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 sharing (see the "Registering your layout templates with ArcGIS Server" section above). It also matters whether you want to add a new layout to the folder or just 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 execution time.
If you registered your layout templates folder with the server before sharing, this means the server can see your layouts. If you make updates to 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.