public class SVGFormat : ExportFormat
Public Class SVGFormat Inherits ExportFormat
public class SVGFormat : ExportFormat
Public Class SVGFormat Inherits ExportFormat
//This example demonstrates how to export a layout to SVG. //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 ExportLayoutToSVGExample { public static Task ExportLayoutToSVGAsync(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 SVG format with appropriate settings SVGFormat SVG = new SVGFormat(); SVG.Resolution = 300; SVG.OutputFileName = Path; return QueuedTask.Run(() => { //Export Layout Layout lyt = layoutItem.GetLayout(); //Loads and returns the layout associated with a LayoutItem if (SVG.ValidateOutputFilePath()) { lyt.Export(SVG); } }); } }
//This example demonstrates how to export an individual map frame on a layout to SVG. //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 ExportMapFrameToSVGExample { public static Task ExportMapFrameToSVGAsync(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 SVG format with appropriate settings SVGFormat SVG = new SVGFormat(); SVG.Resolution = 300; SVG.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; SVG.OutputFileName = Path; if (SVG.ValidateOutputFilePath()) { mf.Export(SVG); } }); } }
//This example demonstrates how to export the active mapview to SVG. //Added references using ArcGIS.Desktop.Framework.Threading.Tasks; //QueuedTask using ArcGIS.Desktop.Mapping; //MapView and Export formats public class ExportActiveMapToSVGExample { public static Task ExportActiveMapToSVGAsync(string Path) { return QueuedTask.Run(() => { //Reference the active map view MapView mapv = MapView.Active; //Create SVG format with appropriate settings SVGFormat SVG = new SVGFormat(); SVG.Resolution = 300; SVG.Height = 500; SVG.Width = 800; SVG.OutputFileName = Path; //Export active map view if (SVG.ValidateOutputFilePath()) { mapv.Export(SVG); } }); } }
SVGFormat SVG = new SVGFormat();
System.Object
ArcGIS.Desktop.Mapping.ExportFormat
ArcGIS.Desktop.Mapping.SVGFormat
Target Platforms: Windows 11, Windows 10