Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I'm printing a Pagelayout, is there any API for hiding the MapFrame or stop it from getting draw on the printout? I would like to only print the Legend on the paper.

share|improve this question
up vote 2 down vote accepted

Create a Mask [white fill polygon with no outline] of the Map Extent, but keep the legend on top of the Mask you create.. Can be done programmatically with ArcEngine.

Another route would be to create a polygon at the top in the Data Frame (either a graphic or new feature class, note:graphics blocks annotation too) and use the map extent of all features and use that to temporally block out all features in the layout view. Legend would remain. Simply remove graphic/polygon after printing of the legend. again programmatically acheivable.

share|improve this answer
I'm going down this route: I'm going to create a legend and mask programmatically, and switch it off and on depending on if the user want to print the map or the legend. – MathiasWestin Sep 10 '10 at 17:58

you need to turn off the autoupdates for the legend. once you build the legend from the frame and turn off the only display layer that are checked on. then you can simply move the data frame off the page layout. and resize the legend.

share|improve this answer
what are you reffering to when you say, "you need to turn off the autoupdates for the legend"? – MathiasWestin Sep 10 '10 at 17:54
Not familiar with engine, but there should be a method on the legend to do this. In the software directly there is a tick on the legend properties. if the layer is turned off it disapears from the legend. – Brad Nesom Sep 13 '10 at 15:47

There's no rule that I'm aware of requiring the mapframe to always be located within the page. When I move the mapframe off the page (but leave the legend) all I see is the legend when I do File>Print Preview. This could be done programatically.

share|improve this answer
I take look, if I'm able to do it without code it would be great for maintainabillity. – MathiasWestin Sep 10 '10 at 5:57
I tested this way, but for me there is a to big performance impact when I add a new map to the layout, but if you don't use arcgis server layers this probably is the best way to solve the problem. – MathiasWestin Sep 10 '10 at 17:52

You can just easily use the Map Server's SOAP API if you want only the legend swatches. Otherwise you could export a page layout with the MapElement hidden.

Check out the ArcObjects documentation for MapServer, (MapServer -> IMapServerLayout -> exportLayout method)

share|improve this answer
Thanks, but I want to do this i arcgis engine, I've added a tag that I'm trying to do this in ArcGIS engine now. – MathiasWestin Sep 10 '10 at 5:53
You can do that with ArcGIS Engine as well. Look at the documentation for the class "MapServer" or "IMapServer".… – user298 Sep 10 '10 at 21:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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