Any examples of how to print a map using the ArcGIS API for Javascript (JSAPI)?

All from the client?

3 Answers 3


Version 2.6 of the ArcGIS API for JavaScript (released today :) ) adds a print dijit and a print task. These both take advantage of ArcGIS Server 10.1 print service. A simple sample using the print dijit is also available. Note that the 10.1 service used in the sample is from a beta release of ArcGIS Server 10.1.


You should try a Google search for this. I tried "ArcGIS API for Javascript Printing" and the first result was the following blog entry on the ArcGIS Server Blog: ArcGIS Javascript API printing through PDF. For reference, the article specifically suggests viewing the example in the code gallery; however, on follow-up I could not find the example via the link or using their search. They also posted an example in the blog here. You could right click -> view source in your browser and examine the code yourself.

Additionally, the ArcGIS API for Javascript Basic Viewer template includes printing functionality.


Sorry, no example, but some hints on how to make high quality prints from the client with dynamic server layers. I haven't done this in JSAPI, but I've used similar techniques in Web ADF and silverlight.

The problem with client side printing is that you will only get screen resolution in your printouts unless you request a map image with higher DPI. When using dynamic layers this is possible.

The trick is to keep track of the current extent, size of map control, layer definitions and visible layers and request the same map image with a higher DPI setting. Stuff that image into an img tag with a defined size and print using your browser.

Request the map using REST or maybe the exportMapImage method of the ArcGISDynamicMapLayer can be used. Create an img tag on a new page, optionally with some headers and text, with height and width same as the map if you want to print the same extent. Set the image source to your map image, which will contain a lot more pixels than the size of the img tag and thus when printing will generate a high quality print with a defined scale.

If you have several layers and graphics, this approach soon becomes very nasty.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.