Skip To Content

Printing

In this topic

Version 3.7

Printing in the ArcGIS API for Flex

High-quality printing is a key feature introduced with ArcGIS 10.1 for Server. Prior to version 3.x, printing in the ArcGIS API for Flex was limited to basic print functionality using the Flex SDK. This approach provided basic print functionality, but it did not lend the high-quality, full cartographic print functionality that many required for their web mapping applications.

The ArcGIS API for Flex makes use of this high-quality print functionality via its PrintTask class. This class generates a printer-ready version of the map through the new Export Web Map Geoprocessing (GP) task in ArcGIS 10.1. This task can also be configured with custom layout templates, in addition to also providing a set of output types, such as PDF, PNG, and SVG.

Since you are actually working with the URL endpoint to an Export Web Map GP task, you will need to first start an ArcGIS 10.1 print task service. This service URL parameter is required and is configured outside of the Flex API. By default, a synchronous GP task is created when ArcGIS 10.1 is installed and initially configured. This means that no other work is required on ArcGIS 10.1 to enable using the PrintTask, other than starting the PrintingTools, GP service, by an ArcGIS Viewer for Flex application developer. Typically, in ArcGIS 10.1, this GP task is located in the ArcGIS REST services directory in the Utilities folder as a Utilities/ExportWebMap (GPServer) service.

Export Web Map GP Task Rest services directory

The Export Web Map Task takes the state of the web application, for example, the included services, layer visibility settings, client-side graphics, etc. and returns either a page layout or a map without page surrounds of the given area of interest in raster or vector format.

The input for the Export Web Map is text given in JavaScript object notation (JSON) format. The JSON text describes the layers, graphics, and other settings in the web map. The JSON must be structured according to the ExportWebMap specification as seen in the ArcGIS Help. This task is automatically provided with ArcGIS 10.1 to support web services for printing, including the preconfigured service named PrintingTools.

To get a good idea of how the PrintTask works with 10.1 print services, the print widget's source code provides a good example of how to implement and work with this functionality. You can download and access this at github. If you have the full application downloaded, refer to the ExportWebMapForm.mxml file located in the src/widgets/print folder. Specifically, take note of the exportWebMapClickHandler event. Similar to other GP services, there is a method for submitjob and execute depending on whether the service is configured asynchronously or synchronously respectively. Both of these methods take a PrintParameters parameter which specifies the input parameters for the PrintTask. A few of these parameters may include exportOptions, format, and layoutTemplate.

After executing the PrintTask, the resulting map image is stored in a specified server directory. By default, this will be the output server directory for the ArcGIS for Server installation. More information on working with Server directories can be found at About server directories.

The following screen capture is a sample of a resulting PDF file with map and additional layout elements. This resulting PDF file is located in the Server's output directory.

Sample high-quality printout

For more detailed information on the PrintingTools GP service, see PrintingTools Service Tutorial video.

More information regarding the topics discussed above can be found at:

Note:

If you do not wish to use ArcGIS for Server for high-quality printing, you can still use the older method of printing everything on the screen using the Flex SDK. Please see the sample, Printing with Flex as a reference to how to print using the FlexPrintJob class.

Printing Limitations

  1. Printing client-side graphics using simple marker symbols of style 'triangle' requires ArcGIS 10.1Service Pack 1.
  2. CompositeSymbols and InfoSymbol are not supported, nothing will be printed.
  3. When printing clustered graphics, the actual features will be printed instead of the cluster.
  4. Printing of ArcIMS layers is not supported.
  5. WebTiledLayers are supported starting with ArcGIS 10.2