Custom print services allow us to create unique layouts with custom elements such as dynamic legends, scales and automated text labels. Dynamic legends can be a great feature to automatically toggle layers in the output legend area - but sometimes printed legend patches may appear garbled/pixelated/grainy. This is a known issue that may occur but thankfully there are some fixes available. The issue may appear after a server or software upgrade and will happen consistently when requesting the same print size and DPI. There are many possible causes including the map document (MXD) layout, ArcGIS Server configuration, or even much deeper into the server settings.

Troubleshooting

Before jumping into the server settings, make sure the legend issue doesn’t occur in ArcGIS Desktop when printing from the same template. Second, do a quick check of the print service DPI settings in your print service and your application. Low DPI requests can generalize the output graphics, especially if using custom fills or transparencies. Try using a value of at least 96 DPI, up to 600 DPI to see the impacts this setting has on your outputs. Beware, setting DPI too high results in each print request taking more time, so don’t go overboard unless your users are prepared to wait. If DPI isn’t specified, 96 is the default for the ExportWebMap specification. Print services are Synchronous by default but can be set up as Asynchronous if requests are expected to take a while do to size or high DPI. Side note: print services used in the ArcGIS Enterprise portal must be Synchronous.

Using Windows Server and still not working?

On Windows, ArcGIS Server printing services rely on the underlying Windows Graphics Device Interface (GDI) Print API. The GDI Print API provides applications with a device-independent printing interface. ArcGIS Server uses this GDI to render text and graphics returning the results to ArcGIS Server which passes the results back to the user.

When leveraging the Windows OS environment for AGS, Esri notes that “If a legend patch with a picture fill or marker symbol type falls outside the default page size of the Windows default printer, Windows GDI drawing calls used by Print Service may not properly draw the object or image on output.” Cool. In short, the GDI configuration is based on your default printer setup. The most likely culprit is requesting a map output larger than the default printer’s default paper size. Since the print GDI rendering starts in the top-left, legend issues become more common the further they are to the right and lower corner where they can extend beyond the default page.

Possible Windows GDI fixes

Since ArcGIS Server leverages the default printer settings for the GDI, we can update the default settings to fix it. To update, we need to log into the server under the ArcGIS Server Account.

Note: This is the account that was chosen during the ArcGIS Server setup. Windows Task Manager can also be used on the server machine to find out which user is being used to run the ArcSOC.exe process.

Once logged in, review and update the default page size and orientation printing settings. When complete, you will need to restart the ArcGIS Server service as an admin, or reboot. It’s recommended to set the page size to the same or larger than the biggest map layout needed.

If a pixelated legend persists, change the default printer completely. This isn’t a proposed solution in the bug report but it has been the one solution that has worked in the past for me: Changed the default printer and still used the same page settings. To change to a new printer you may need to log in as a local administrator to add the printer to the server first, then it will be available to the ArcGIS Server account (the ArcGIS Server account is a local user account with very limited permissions). Again, you will need to restart the ArcGIS service as an administrator or reboot for changes to take place. Side note: Esri recommends stopping the service first (admin account), change the print defaults (arcgis account), start the service again (admin account).

After the problem is resolved it’s recommended to binge the movie Office Space so you can watch someone take a baseball bat to a printer for a few minutes - very therapeutic.