Viewing By Entry / Main
October 31, 2008

Printing With The New ArcGIS Server JS API

A reader recently sent us a email wondering about printing with the ArcGIS Server Javascript api. It was a great question that I'm sure others have, so I thought we would share our response to her.

Gabi writes:

I was trying to print a map from your page

http://maps.roktech.net/GoMaps93/

I can’t get the map to print. I was wondering if you were aware of that problem?!

We have just published our ArcGIS Server Javascript API for the residential election and we have a similar problem not able to print the map – on some printers!

I have tested 18 different printers and 12 printed the map ok but 6 did not.

I’m just checking on this print issue with you to see what kind of problems you have experienced if any at all!

This would be a forum ESRI link with discussion about printing from an ArcGIS Server Javascript API.

http://forums.esri.com/Thread.asp?c=158&f=2396&t=266413&mc=5#msgid822082

Thank you



Trent, our lead ArcGIS Server developer responds:

Gabriela,

We have had problems printing with the Javascript API as well. To start, you can not pass user drawn graphics to a print page. This pretty much eliminates the drawing tools for us. If our users can draw on a map, they are going to want to print their graphics with the map. Another issue is with IE. Internet explorer will only print the first two graphics layers. If you print from firefox you will get everything. This may be the issue you ran into with the different printers. It may not have been the printer, but the browser.

One solution around the drawing graphics is to reformat the main page for printing. Basically, you would hide or reposition your page elements by using div tags. You would also need to resize the map, so it fit on one print page. This can all be done dyanmically without having to open up a new window or print page. After the user prints the page, you can return all of the page elements to normal. Once again, in IE you will only get the graphics and the 1st layer.

One work around for the IE printing issue is to use a server side programming language to mass each of your layers together into 1 image. The server side code would make image request to each layer individually. Then, the server side code would take those images and merge them together. The resulting image would be passed back to the print page as 1 image. Consequently, you would see all of the layers when printing from IE. Once again, you are still limited from printing user drawn graphics.

I'm not sure if this helped you at all, but I would be more than happy to help if you are having a specific problem. Although our printing is not where we would like it to be, we have been able to print maps by passing query paramaters to a print page.

Here is an example of one of our print pages. It may be a little slow loading, as we are building cache on that server. After the page loads completely, displaying the parcel graphic and the parcel attributes, the browser's print dialog will come up.

http://beta.roktech.net/Flagler93/print.htm?pid=07-11-31-7024-00520-0040&XMin=-81.2210496187643&YMin=29.525174008735704&XMax=-81.2197409152355&YMax=29.526482712264496&h=600&v=4

Thanks,

Trent

Comments

25wIAw <a href="http://cbrhiowhnkwp.com/">cbrhiowhnkwp</a>, [url=http://eshcuksxzxuw.com/]eshcuksxzxuw[/url], [link=http://clewchowlzhc.com/]clewchowlzhc[/link], http://flbmiudhzkzj.com/