ArcObjects Library Reference  (Carto)    

IMapServerLayout.ExportLayout Method

Generates an image of the layout, based on the given page description object, and writes the image to a specified file on disk. Supported file types are: 'bmp', 'jpg', 'tif', 'png'/'png8', 'png24', 'emf', 'ps', 'pdf', 'ai', 'gif', and 'svg'/'svgz'.

[Visual Basic 6.0]
Function ExportLayout(
    ByVal pageDesc As IPageDescription, _
    ByVal imageDesc As IImageDescription _
) As ILayoutImage
[Visual Basic .NET]
Public Function ExportLayout ( _
    ByVal pageDesc As IPageDescription, _
    ByVal imageDesc As IImageDescription _
) As ILayoutImage
[C#]
public ILayoutImage ExportLayout (
    IPageDescription pageDesc,
    IImageDescription imageDesc
);
[Java]
public ILayoutImage exportLayout (
    IPageDescription pageDesc,
    IImageDescription imageDesc
)
throws
    IOException,
    AutomationException
[C++]
HRESULT ExportLayout(
  IPageDescription* pageDesc,
  IImageDescription* imageDesc,
  ILayoutImage** LayoutImage
);
[C++]

Parameters

pageDesc [in]

  pageDesc is a parameter of type IPageDescription

imageDesc [in]

  imageDesc is a parameter of type IImageDescription

LayoutImage [out, retval]

  LayoutImage is a parameter of type ILayoutImage

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Remarks

Use ExportLayout to retrieve an image of the map's layout.

PageDescription refers to properties describing the actual map layout. These include the height and width of the layout in page units, the layout page extent in page units, map descriptions for each map frame in the layout and any CustomGraphics to be placed in the layout. Size, resolution and file format are determined by the ImageDescription, which includes ImageDisplay and ImageType.

ExportLayout returns a LayoutImage object. The page extent of the layout, an array of map images (data frames), can be gleaned from this object. In addition, the geographic extent, map scale and an array of visible layers for each data frame in the layout can be retrieved from the MapImage object.

Do not use IMapServerLayout to create new layouts or to create layouts "on-the-fly". You cannot change the actual page size of the map layout, reposition map elements on the layout nor can you add or remove layout elements such as titles, text, graphics, scale bars, north arrows and legends.

Let's look at an example. An existing map layout has a portrait page orientation with a height of 11 inches and a width of 8.5 inches. The absolute scale for the map is 1:30,000,000. This scale is based on the page size of the layout and the relative size of the map's data frame.

To export this layout at the size set in the ArcMap document enter a value of 0 for the height or width properties of IImageDisplay. ImageDisplay is part of the ImageDescription parameter needed for ExportLayout. In this example exporting to a raster format at 96 dpi would result in an image 1056 by 816 pixels.

The size of ExportLayout results can be adjusted using the height and width properties of IImageDisplay. You can increase or decrease the relative size of the map layout. It is important to keep in mind the limitations of doing this. For example, you wish to reduce the image of the 11 by 8.5 layout described above by half.  You specify a height of 528 and a width of 408 for the image result. Please note that the map scale does not change. Remember, it is the output size of the image result that is being adjusted. Therefore, the absolute scale of the map will be incorrect, though the scale bar should be correct since its size changes relative to the change in output size. This effect is similar to shrinking or enlarging a printed map using a photocopying machine.

Not specifying a height and width for IImageDisplay, or specifying 0 for both, will cause the export result to maintain the original size of the layout as specified in the map document.  The Height and Width properties of IImageResult are read-only and are not used to make changes.

Changing the aspect ratio (height x width) of the ExportLayout output will not change the aspect ratio of the map layout. For example, again using the layout example above, a height of 816 and a width of 1056 pixels are specified. This will not change the orientation of the page layout from portrait to landscape. Instead, the original portrait orientation of the layout will be maintained and will be fitted into the 816 x 1056 space. This will result in white space on either side of the layout.

In order to control the size of an exported image, IMapServerInit contains two properties: MaxImageHeight and MaxImageWidth. The default value for these properties is 1024 pixels.

Another important thing to consider when exporting layouts using IMapServerLayout is to uncheck the "Use Printer Paper Settings" checkbox on the Page and Print Setup dialog in ArcMap. Otherwise, the page setup may be dependent on a printer unavailable to the server or users. This may result in a rescaling of the map and unexpected results.

See Also

IMapServerLayout Interface

 


Feedback Send feedback on this page