Handles working with and viewing layouts in an ArcMap Server service.
Object Model
Syntax
Visual Basic (Usage) | Copy Code |
---|
Dim instance As LayoutView |
Example
The following example creates a LayoutView, and sets the output type to PDF. It then displays some information about one of its data frames, and sets the projection and extent of the data frame. Finally, it generates an output PDF file for the layout.
C# | Copy Code |
---|
LayoutView layoutView = mapService.CreateLayoutView();
// Set output type to PDF
layoutView.ImageDescriptor.ImageFormat = ESRI.ArcGIS.ADF.Web.ImageFormat.PDF;
DataFrame worldFrame = layoutView.DataFrames[1];
// Print some information about the data frame
lblDataFrameInfo.Text =
"Data frame information:<br>" +
"Data frame name: " + worldFrame.Name + "<br>" +
"First layer name: " + worldFrame.Layers[0].Name + "<br>" +
"Background color: " + worldFrame.BackColor.Name + "<br>" +
"Default extent: " + worldFrame.DefaultExtent.ToString() + "<br>" +
"Map units: " + worldFrame.MapUnits.ToString() + "<br>";
// Use the Robinson projection (ID of 54030) for one data frame
SpatialReference spatialRef = new SpatialReference(54030);
worldFrame.SpatialReference = spatialRef;
// Set the extent of the data frame with geographic coordinates
Envelope worldEnv = new Envelope(-130, 25, -100, 50);
worldEnv.SpatialReference = new SpatialReference(4326);
worldFrame.Extent = worldEnv;
// Generate a layout file
ESRI.ArcGIS.ADF.Web.CartoImage image = layoutView.Draw();
lblLayoutView.Text = "Layout is available at: " + image.Url; |
Visual Basic | Copy Code |
---|
Dim layoutView As LayoutView = mapService.CreateLayoutView()
' Set output type to PDF
layoutView.ImageDescriptor.ImageFormat = ESRI.ArcGIS.ADF.Web.ImageFormat.PDF
DataFrame worldFrame = layoutView.DataFrames(0)
' Print some information about the data frame
lblDataFrameInfo.Text = _
"Data frame information:<br>" + _
"Data frame name: " + worldFrame.Name + "<br>" + _
"First layer name: " + worldFrame.Layers(0).Name + "<br>" + _
"Background color: " + worldFrame.BackColor.Name + "<br>" + _
"Default extent: " + worldFrame.DefaultExtent.ToString() + "<br>" + _
"Map units: " + worldFrame.MapUnits.ToString() + "<br>"
' Use the Robinson projection (ID of 54030) for one Data frame
SpatialReference spatialRef = New SpatialReference(54030)
worldFrame.SpatialReference = spatialRef
' Set the extent of the Data frame with geographic coordinates
Envelope worldEnv = New Envelope(-130, 25, -100, 50)
worldEnv.SpatialReference = New SpatialReference(4326)
worldFrame.Extent = worldEnv
' Generate a layout file
ESRI.ArcGIS.ADF.Web.CartoImage image = layoutView.Draw()
lblLayoutView.Text = "Layout is available at: " + image.Url |
Requirements
Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family
See Also