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.


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.

| 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.

| 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.

| 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)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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