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