public class JPEGFormat : ExportFormat
Public Class JPEGFormat Inherits ExportFormat
public class JPEGFormat : ExportFormat
Public Class JPEGFormat Inherits ExportFormat
//This example demonstrates how to export a layout to JPEG. //Added references using ArcGIS.Desktop.Core; //Project using ArcGIS.Desktop.Layouts; //Layout classes using ArcGIS.Desktop.Framework.Threading.Tasks; //QueuedTask using ArcGIS.Desktop.Mapping; //Export formats public class ExportLayoutToJPEGExample { public static Task ExportLayoutToJPEGAsync(string LayoutName, string Path) { //Reference a layoutitem in a project by name LayoutProjectItem layoutItem = Project.Current.GetItems<LayoutProjectItem>().FirstOrDefault(item => item.Name.Equals(LayoutName)); if (layoutItem == null) return Task.FromResult<Layout>(null); //Create JPEG format with appropriate settings JPEGFormat JPEG = new JPEGFormat(); JPEG.Resolution = 300; JPEG.OutputFileName = Path; return QueuedTask.Run(() => { //Export Layout Layout lyt = layoutItem.GetLayout(); //Loads and returns the layout associated with a LayoutItem if (JPEG.ValidateOutputFilePath()) { lyt.Export(JPEG); } }); } }
//This example demonstrates how to export an individual map frame on a layout to JPEG. //Added references using ArcGIS.Desktop.Core; //Project using ArcGIS.Desktop.Layouts; //Layout classes using ArcGIS.Desktop.Framework.Threading.Tasks; //QueuedTask using ArcGIS.Desktop.Mapping; //Export formats public class ExportMapFrameToJPEGExample { public static Task ExportMapFrameToJPEGAsync(string LayoutName, string MFName, string Path) { //Reference a layoutitem in a project by name LayoutProjectItem layoutItem = Project.Current.GetItems<LayoutProjectItem>().FirstOrDefault(item => item.Name.Equals(LayoutName)); if (layoutItem == null) return Task.FromResult<Layout>(null); //Create JPEG format with appropriate settings JPEGFormat JPEG = new JPEGFormat(); JPEG.HasWorldFile = true; JPEG.Resolution = 300; JPEG.OutputFileName = Path; return QueuedTask.Run(() => { //Export MapFrame Layout lyt = layoutItem.GetLayout(); //Loads and returns the layout associated with a LayoutItem MapFrame mf = lyt.FindElement(MFName) as MapFrame; JPEG.OutputFileName = Path; if (JPEG.ValidateOutputFilePath()) { mf.Export(JPEG); } }); } }
//This example demonstrates how to export the active mapview to JPEG. //Added references using ArcGIS.Desktop.Framework.Threading.Tasks; //QueuedTask using ArcGIS.Desktop.Mapping; //MapView and Export formats public class ExportActiveMapToJPEGExample { public static Task ExportActiveMapToJPEGAsync(string Path) { return QueuedTask.Run(() => { //Reference the active map view MapView map = MapView.Active; //Create JPEG format with appropriate settings JPEGFormat JPEG = new JPEGFormat(); JPEG.Resolution = 300; JPEG.Height = 500; JPEG.Width = 800; JPEG.HasWorldFile = true; JPEG.OutputFileName = Path; //Export active map view if (JPEG.ValidateOutputFilePath()) { map.Export(JPEG); } }); } }
System.Object
ArcGIS.Desktop.Mapping.ExportFormat
ArcGIS.Desktop.Mapping.JPEGFormat
Target Platforms: Windows 10, Windows 8.1