You can use the PrintingTools service to print maps that contain secure services.
If you use short-term tokens to secure services
If you secure your services using short-term tokens (the default), the user will be challenged to provide the name and password upon opening the web app. The token is then passed to the PrintingTools service when the user requests a map to be printed.
Embed credentials into your print service
In some cases when publishing your own print service that contains secured services, you need to embed credentials into the print service that it can use when requesting maps from the secured services. The steps at the end of this section detail how to do so.
If you embed a long-term token in your web app code, the authentication information cannot be passed to the PrintingTools service. Regardless of your server configuration, you need to embed credentials into the print service using the steps below.
If you enforce security at the web server tier, and your ArcGIS Server is federated with an ArcGIS Enterprise portal, printing maps with the PrintingTools service is supported by default with no additional steps needed. However, if you have a standalone installation of ArcGIS Server and you enforce security at the web server tier, you need to embed credentials using the steps below.
It is not recommended to embed credentials in a custom print service without fully understanding the security impact. If you choose to publish your own service for printing with embedded credentials, it's recommended that you apply ArcGIS Server security rules to restrict who can access the service. This prevents anonymous users from generating printable map images that display your secured services. See Restricting access to GIS web services to learn more about setting up security.
These steps are only available when preparing a print service to be published from ArcMap. It is not available when publishing a print service from ArcGIS Pro.
- In the Catalog window of ArcMap, expand Toolboxes > My Toolboxes.
- Right-click My Toolboxes and click New > Toolbox.
- Give your toolbox a name, such as SecurePrinting.tbx.
- In the Catalog tree, expand Toolboxes > System Toolboxes > Server Tools.tbx > Printing.
- Right-click the Export Web Map tool and click Copy.
- Right-click the toolbox you created in step 2 and click Paste.
- Right-click the pasted Export Web Map tool from your own toolbox and click Edit.
- Click the plus (+) button and browse to the GIS server connection that contains the secured services you want to print.
The connection needs to have the name and password saved with it. It should be a user connection, not a publisher or administrative connection.
If you don't see any connections available, return to the Catalog tree and make one, using the instructions in Making a user connection to ArcGIS Server in ArcGIS Desktop.
You can add connections to as many servers as you need to support your printing service. Click OK when you finish adding connections.
- Publish the Export Web Map tool from your own toolbox as a geoprocessing service using the steps in Tutorial: Publish additional services for printing. In Step 2 of the tutorial, open the Export Web Map tool you pasted during the steps above. Do not open the original Export Web Map tool from the Server Tools toolbox.