ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / ExportFormat Class / ValidateOutputFilePath Method
Example

In This Topic
    ValidateOutputFilePath Method (ExportFormat)
    In This Topic
    Validates the output file path.
    Syntax
    public virtual bool ValidateOutputFilePath()
    Public Overridable Function ValidateOutputFilePath() As Boolean
    Example
    Layout_ExportPDF
      //Export a layout to PDF
    
      //Create a PDF export format
      PDFFormat pdf = new PDFFormat()
      {
        OutputFileName = filePath,
        Resolution = 300,
        DoCompressVectorGraphics = true,
        DoEmbedFonts = true,
        HasGeoRefInfo = true,
        ImageCompression = ImageCompression.Adaptive,
        ImageQuality = ImageQuality.Best,
        LayersAndAttributes = LayersAndAttributes.LayersAndAttributes
    };
    
      //Check to see if the path is valid and export
      if (pdf.ValidateOutputFilePath())
      {
        await QueuedTask.Run(() => layout.Export(pdf)); //Export the PDF
      }
    ExportBMP_Layout
    //This example demonstrates how to export a layout to BMP.
    
    //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 ExportLayoutToBMPExample
    {
      public static Task ExportLayoutToBMPAsync(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 BMP format with appropriate settings
        BMPFormat BMP = new BMPFormat();
        BMP.Resolution = 300;
        BMP.OutputFileName = Path;
    
        return QueuedTask.Run(() =>
        {
                //Export Layout
                Layout lyt = layoutItem.GetLayout(); //Loads and returns the layout associated with a LayoutItem
                if (BMP.ValidateOutputFilePath())
          {
            lyt.Export(BMP);
          }
        });
      }
    }
    ExportBMP_MapFrame
    //This example demonstrates how to export an individual map frame on a layout to BMP.
    
    //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 ExportMapFrameToBMPExample
    {
      public static Task ExportMapFrameToBMPAsync(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 BMP format with appropriate settings
        BMPFormat BMP = new BMPFormat();
        BMP.HasWorldFile = true;
        BMP.Resolution = 300;
        BMP.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;
          BMP.OutputFileName = Path;
          if (BMP.ValidateOutputFilePath())
          {
            mf.Export(BMP);
          }
        });
      }
    }
    ExportBMP_ActiveMap
    //This example demonstrates how to export the active mapview to BMP.
    
    //Added references
    using ArcGIS.Desktop.Framework.Threading.Tasks;    //QueuedTask
    using ArcGIS.Desktop.Mapping;                      //MapView and Export formats
    
    public class ExportActiveMapToBMPExample
    {
      public static Task ExportActiveMapToBMPAsync(string Path)
      {
        return QueuedTask.Run(() =>
        {
          //Reference the active map view
          MapView map = MapView.Active;
    
          //Create BMP format with appropriate settings
          BMPFormat BMP = new BMPFormat();
          BMP.Resolution = 300;
          BMP.Height = 500;
          BMP.Width = 800;
          BMP.HasWorldFile = true;
          BMP.OutputFileName = Path;
    
          //Export active map view
          if (BMP.ValidateOutputFilePath())
          {
            map.Export(BMP);
          }
        });
      }
    }
    ExportEMF_Layout
    //This example demonstrates how to export a layout to EMF.
    
    //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 ExportLayoutToEMFExample
    {
      public static Task ExportLayoutToEMFAsync(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 EMF format with appropriate settings
        EMFFormat EMF = new EMFFormat();
        EMF.Resolution = 300;
        EMF.OutputFileName = Path;
    
        return QueuedTask.Run(() =>
        {
                //Export Layout
                Layout lyt = layoutItem.GetLayout(); //Loads and returns the layout associated with a LayoutItem
                if (EMF.ValidateOutputFilePath())
          {
            lyt.Export(EMF);
          }
        });
      }
    }
    ExportEMF_MapFrame
    //This example demonstrates how to export an individual map frame on a layout to EMF.
    
    //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 ExportMapFrameToEMFExample
    {
      public static Task ExportMapFrameToEMFAsync(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 EMF format with appropriate settings
        EMFFormat EMF = new EMFFormat();
        EMF.Resolution = 300;
        EMF.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;
          EMF.OutputFileName = Path;
          if (EMF.ValidateOutputFilePath())
          {
            mf.Export(EMF);
          }
        });
      }
    }
    ExportEMF_ActiveMap
    //This example demonstrates how to export the active mapview to EMF.
    
    //Added references
    using ArcGIS.Desktop.Framework.Threading.Tasks;    //QueuedTask
    using ArcGIS.Desktop.Mapping;                      //MapView and Export formats
    
    public class ExportActiveMapToEMFExample
    {
      public static Task ExportActiveMapToEMFAsync(string Path)
      {
        return QueuedTask.Run(() =>
        {
                //Reference the active map view
                MapView map = MapView.Active;
    
                //Create EMF format with appropriate settings
                EMFFormat EMF = new EMFFormat();
          EMF.Resolution = 300;
          EMF.Height = 500;
          EMF.Width = 800;
          EMF.OutputFileName = Path;
    
                //Export active map view
                if (EMF.ValidateOutputFilePath())
          {
            map.Export(EMF);
          }
        });
      }
    }
    ExportEPS_Layout
    //This example demonstrates how to export a layout to EPS.
    
    //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 ExportLayoutToEPSExample
    {
      public static Task ExportLayoutToEPSAsync(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 EPS format with appropriate settings
        EPSFormat EPS = new EPSFormat();
        EPS.Resolution = 300;
        EPS.OutputFileName = Path;
    
        return QueuedTask.Run(() =>
        {
                //Export Layout
                Layout lyt = layoutItem.GetLayout(); //Loads and returns the layout associated with a LayoutItem
                if (EPS.ValidateOutputFilePath())
          {
            lyt.Export(EPS);
          }
        });
      }
    }
    ExportEPS_MapFrame
    //This example demonstrates how to export an individual map frame on a layout to EPS.
    
    //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 ExportMapFrameToEPSExample
    {
      public static Task ExportMapFrameToEPSAsync(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 EPS format with appropriate settings
        EMFFormat EPS = new EMFFormat();
        EPS.Resolution = 300;
        EPS.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;
          EPS.OutputFileName = Path;
          if (EPS.ValidateOutputFilePath())
          {
            mf.Export(EPS);
          }
        });
      }
    }
    ExportEPS_ActiveMap
    //This example demonstrates how to export the active mapview to EPS.
    
    //Added references
    using ArcGIS.Desktop.Framework.Threading.Tasks;    //QueuedTask
    using ArcGIS.Desktop.Mapping;                      //MapView and Export formats
    
    public class ExportActiveMapToEPSExample
    {
      public static Task ExportActiveMapToEPSAsync(string Path)
      {
        return QueuedTask.Run(() =>
        {
                //Reference the active map view
                MapView mapv = MapView.Active;
    
                //Create EMF format with appropriate settings
                EPSFormat EPS = new EPSFormat();
          EPS.Resolution = 300;
          EPS.Height = 500;
          EPS.Width = 800;
          EPS.OutputFileName = Path;
    
                //Export active map view
                if (EPS.ValidateOutputFilePath())
          {
            mapv.Export(EPS);
          }
        });
      }
    }
    ExportGIF_Layout
    //This example demonstrates how to export a layout to GIF.
    
    //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 ExportLayoutToGIFExample
    {
      public static Task ExportLayoutToGIFAsync(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 GIF format with appropriate settings
        GIFFormat GIF = new GIFFormat();
        GIF.Resolution = 300;
        GIF.OutputFileName = Path;
    
        return QueuedTask.Run(() =>
        {
                //Export Layout
                Layout lyt = layoutItem.GetLayout(); //Loads and returns the layout associated with a LayoutItem
                if (GIF.ValidateOutputFilePath())
          {
            lyt.Export(GIF);
          }
        });
      }
    }
    ExportGIF_MapFrame
    //This example demonstrates how to export an individual map frame on a layout to GIF.
    
    //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 ExportMapFrameToGIFExample
    {
      public static Task ExportMapFrameToGIFAsync(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 GIF format with appropriate settings
        GIFFormat GIF = new GIFFormat();
        GIF.HasWorldFile = true;
        GIF.Resolution = 300;
        GIF.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;
          GIF.OutputFileName = Path;
          if (GIF.ValidateOutputFilePath())
          {
            mf.Export(GIF);
          }
        });
      }
    }
    ExportGIF_ActiveMap
    //This example demonstrates how to export the active mapview to GIF.
    
    //Added references
    using ArcGIS.Desktop.Framework.Threading.Tasks;    //QueuedTask
    using ArcGIS.Desktop.Mapping;                      //MapView and Export formats
    
    public class ExportActiveMapToGIFExample
    {
      public static Task ExportActiveMapToGIFAsync(string Path)
      {
        return QueuedTask.Run(() =>
        {
                //Reference the active map view
                MapView mapv = MapView.Active;
    
                //Create GIF format with appropriate settings
                GIFFormat GIF = new GIFFormat();
          GIF.Resolution = 300;
          GIF.Height = 500;
          GIF.Width = 800;
          GIF.HasWorldFile = true;
          GIF.OutputFileName = Path;
    
                //Export active map view
                if (GIF.ValidateOutputFilePath())
          {
            mapv.Export(GIF);
          }
        });
      }
    }
    ExportJPEG_Layout
    //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);
          }
        });
      }
    }
    ExportJPEG_MapFrame
    //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;
          if (JPEG.ValidateOutputFilePath())
          {
            mf.Export(JPEG);
          }
        });
      }
    }
    ExportJPEG_ActiveMap
    //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 mapv = 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())
          {
            mapv.Export(JPEG);
          }
        });
      }
    }
    ExportPDF_Layout
    //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);
          }
        });
      }
    }
    ExportPDF_MapFrame
    //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;
        //PDF.Password = "xxx";
    
        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);
          }
        });
      }
    }
    ExportPDF_ActiveMap
    //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 mapv = 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())
          {
            mapv.Export(PDF);
          }
        });
      }
    }
    ExportPNG_Layout
    //This example demonstrates how to export a layout to PNG.
    
    //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 ExportLayoutToPNGExample
    {
      public static Task ExportLayoutToPNGAsync(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 PNG format with appropriate settings
        PNGFormat PNG = new PNGFormat();
        PNG.Resolution = 300;
        PNG.OutputFileName = Path;
    
        return QueuedTask.Run(() =>
        {
                //Export Layout
                Layout lyt = layoutItem.GetLayout(); //Loads and returns the layout associated with a LayoutItem
                if (PNG.ValidateOutputFilePath())
          {
            lyt.Export(PNG);
          }
        });
      }
    }
    ExportPNG_MapFrame
    //This example demonstrates how to export an individual map frame on a layout to PNG.
    
    //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 ExportMapFrameToPNGExample
    {
      public static Task ExportMapFrameToPNGAsync(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 PNG format with appropriate settings
        PNGFormat PNG = new PNGFormat();
        PNG.Resolution = 300;
        PNG.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;
          PNG.OutputFileName = Path;
          if (PNG.ValidateOutputFilePath())
          {
            mf.Export(PNG);
          }
        });
      }
    }
    ExportPNG_ActiveMap
    //This example demonstrates how to export the active mapview to PNG.
    
    //Added references
    using ArcGIS.Desktop.Framework.Threading.Tasks;    //QueuedTask
    using ArcGIS.Desktop.Mapping;                      //MapView and Export formats
    
    public class ExportActiveMapToPNGExample
    {
      public static Task ExportActiveMapToPNGAsync(string Path)
      {
        return QueuedTask.Run(() =>
        {
                //Reference the active map view
                MapView mapv = MapView.Active;
    
                //Create PNG format with appropriate settings
                PNGFormat PNG = new PNGFormat();
          PNG.Resolution = 300;
          PNG.Height = 500;
          PNG.Width = 800;
          PNG.OutputFileName = Path;
    
                //Export active map view
                if (PNG.ValidateOutputFilePath())
          {
            mapv.Export(PNG);
          }
        });
      }
    }
    ExportSVG_Layout
    //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);
          }
        });
      }
    }
    ExportSVG_MapFrame
    //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);
          }
        });
      }
    }
    ExportSVG_ActiveMap
    //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);
          }
        });
      }
    }
    ExportTGA_Layout
    //This example demonstrates how to export a layout to TGA.
    
    //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 ExportLayoutToTGAExample
    {
      public static Task ExportLayoutToTGAAsync(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 TGA format with appropriate settings
        TGAFormat TGA = new TGAFormat();
        TGA.Resolution = 300;
        TGA.OutputFileName = Path;
    
        return QueuedTask.Run(() =>
        {
                //Export Layout
                Layout lyt = layoutItem.GetLayout(); //Loads and returns the layout associated with a LayoutItem
                if (TGA.ValidateOutputFilePath())
          {
            lyt.Export(TGA);
          }
        });
      }
    }
    ExportTGA_MapFrame
    //This example demonstrates how to export an individual map frame on a layout to TGA.
    
    //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 ExportMapFrameToTGAExample
    {
      public static Task ExportMapFrameToTGAAsync(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 TGA format with appropriate settings
        TGAFormat TGA = new TGAFormat();
        TGA.Resolution = 300;
        TGA.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;
          TGA.OutputFileName = Path;
          if (TGA.ValidateOutputFilePath())
          {
            mf.Export(TGA);
          }
        });
      }
    }
    ExportTGA_ActiveMap
    //This example demonstrates how to export the active mapview to TGA.
    
    //Added references
    using ArcGIS.Desktop.Framework.Threading.Tasks;    //QueuedTask
    using ArcGIS.Desktop.Mapping;                      //MapView and Export formats
    
    public class ExportActiveMapToTGAExample
    {
      public static Task ExportActiveMapToTGAAsync(string Path)
      {
        return QueuedTask.Run(() =>
        {
                //Reference the active map view
                MapView mapv = MapView.Active;
    
                //Create TGA format with appropriate settings
                TGAFormat TGA = new TGAFormat();
          TGA.Resolution = 300;
          TGA.Height = 500;
          TGA.Width = 800;
          TGA.OutputFileName = Path;
    
                //Export active map view
                if (TGA.ValidateOutputFilePath())
          {
            mapv.Export(TGA);
          }
        });
      }
    }
    ExportTIFF_Layout
    //This example demonstrates how to export a layout to TIFF.
    
    //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 ExportLayoutToTIFFExample
    {
      public static Task ExportLayoutToTIFFAsync(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 TIFF format with appropriate settings
        TIFFFormat TIFF = new TIFFFormat();
        TIFF.Resolution = 300;
        TIFF.OutputFileName = Path;
    
        return QueuedTask.Run(() =>
        {
                //Export Layout
                Layout lyt = layoutItem.GetLayout(); //Loads and returns the layout associated with a LayoutItem
                if (TIFF.ValidateOutputFilePath())
          {
            lyt.Export(TIFF);
          }
        });
      }
    }
    ExportTIFF_MapFrame
    //This example demonstrates how to export an individual map frame on a layout to TIFF.
    
    //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 ExportMapFrameToTIFFExample
    {
      public static Task ExportMapFrameToTIFFAsync(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 TIFF format with appropriate settings
        TIFFFormat TIFF = new TIFFFormat();
        TIFF.Resolution = 300;
        TIFF.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;
          TIFF.OutputFileName = Path;
          if (TIFF.ValidateOutputFilePath())
          {
            mf.Export(TIFF);
          }
        });
      }
    }
    ExportTIFF_ActiveMap
    //This example demonstrates how to export the active mapview to TIFF.
    
    //Added references
    using ArcGIS.Desktop.Framework.Threading.Tasks;    //QueuedTask
    using ArcGIS.Desktop.Mapping;                      //MapView and Export formats
    
    public class ExportActiveMapToTIFFExample
    {
      public static Task ExportActiveMapToTIFFAsync(string Path)
      {
        return QueuedTask.Run(() =>
        {
                //Reference the active map view
                MapView mapv = MapView.Active;
    
                //Create TIFF format with appropriate settings
                TIFFFormat TIFF = new TIFFFormat();
          TIFF.Resolution = 300;
          TIFF.Height = 500;
          TIFF.Width = 800;
          TIFF.OutputFileName = Path;
    
                //Export active map view
                if (TIFF.ValidateOutputFilePath())
          {
            mapv.Export(TIFF);
          }
        });
      }
    }
    Layout_ExportMS_PDF
    //Export multiple map series pages to PDF
    
    //Create a PDF export format
    PDFFormat msPDF = new PDFFormat()
    {
      Resolution = 300,
      OutputFileName = filePath,
      DoCompressVectorGraphics = true
    };
    
    //Set up the export options for the map series
    MapSeriesExportOptions MSExport_custom = new MapSeriesExportOptions()
    {
      ExportPages = ExportPages.Custom,
      CustomPages = "1-3, 5",
      ExportFileOptions = ExportFileOptions.ExportAsSinglePDF,
      ShowSelectedSymbology = false
    };
    
    //Check to see if the path is valid and export
    if (msPDF.ValidateOutputFilePath())
    {
      layout.Export(msPDF, MSExport_custom);  //Export the PDF to a single, multiple page PDF. 
    }
    Layout_ExportMS_TIFF
    //Export multiple map series pages to TIFF
    
    //Create a TIFF export format
    TIFFFormat msTIFF = new TIFFFormat()
    {
      Resolution = 300,
      OutputFileName = filePath,
      ColorMode = TIFFColorMode.TwentyFourBitTrueColor,
      HasGeoTiffTags = true,
      HasWorldFile = true
    };
    
    //Set up the export options for the map series
    MapSeriesExportOptions MSExport_All = new MapSeriesExportOptions()
    {
      ExportPages = ExportPages.All,
      ExportFileOptions = ExportFileOptions.ExportMultipleNames,
      ShowSelectedSymbology = false
    };
    
    //Check to see if the path is valid and export
    if (msPDF.ValidateOutputFilePath())
    {
      layout.Export(msPDF, MSExport_All);  //Export each page to a TIFF and apppend the page name suffix to each output file 
    }
    Export a layout to PDF
    //Export a single page layout to PDF.
    
    //Create a PDF format with appropriate settings
    //BMP, EMF, EPS, GIF, JPEG, PNG, SVG, TGA, and TFF formats are also available for export
    PDFFormat PDF = new PDFFormat()
    {
      OutputFileName = filePath,
      Resolution = 300,
      DoCompressVectorGraphics = true,
      DoEmbedFonts = true,
      HasGeoRefInfo = true,
      ImageCompression = ImageCompression.Adaptive,
      ImageQuality = ImageQuality.Best,
      LayersAndAttributes = LayersAndAttributes.LayersAndAttributes
    };
    
    //Check to see if the path is valid and export
    if (PDF.ValidateOutputFilePath())
    {
      await QueuedTask.Run(() => layout.Export(PDF));  //Export the layout to PDF on the worker thread
    }
    Export a map frame to JPG
    //Export a map frame to JPG.
    
    //Create JPEG format with appropriate settings
    //BMP, EMF, EPS, GIF, PDF, PNG, SVG, TGA, and TFF formats are also available for export
    //at 2.x - JPEGFormat JPG = new JPEGFormat()
    //{
    //  HasWorldFile = true,
    //  Resolution = 300,
    //  OutputFileName = filePath,
    //  JPEGColorMode = JPEGColorMode.TwentyFourBitTrueColor,
    //  Height = 800,
    //  Width = 1200
    //};
    JPEGFormat JPG = new JPEGFormat()
    {
      HasWorldFile = true,
      Resolution = 300,
      OutputFileName = filePath,
      ColorMode = JPEGColorMode.TwentyFourBitTrueColor,
      Height = 800,
      Width = 1200
    };
    
    //Reference the map frame
    MapFrame mf = layout.FindElement("MyMapFrame") as MapFrame;
    
    //Export on the worker thread
    await QueuedTask.Run(() =>
    {
      //Check to see if the path is valid and export
      if (JPG.ValidateOutputFilePath())
      {
        mf.Export(JPG);  //Export the map frame to JPG
      }
    });
    Export the map view associated with a map frame to BMP
    //Export the map view associated with a map frame to BMP.
    
    //Create BMP format with appropriate settings
    //EMF, EPS, GIF, JPEG, PDF, PNG, SVG, TGA, and TFF formats are also available for export
    BMPFormat BMP = new BMPFormat()
    {
      Resolution = 300,
      Height = 500,
      Width = 800,
      HasWorldFile = true,
      OutputFileName = filePath
    };
    
    //Reference the active layout view
    LayoutView lytView = LayoutView.Active;
    
    //Reference the map frame and its map view
    MapFrame mf_bmp = layout.FindElement("Map Frame") as MapFrame;
    MapView mv_bmp = mf_bmp.GetMapView(lytView);
    
    if (mv_bmp != null)
    {
      //Export on the worker thread
      await QueuedTask.Run(() =>
      {
    
        //Check to see if the path is valid and export
        if (BMP.ValidateOutputFilePath())
        {
          mv_bmp.Export(BMP);  //Export to BMP
        }
      });
    }
    Export a map series to single PDF
    //Export a map series with multiple pages to a single PDF.
    
    //Create PDF format with appropriate settings
    PDFFormat MS_PDF = new PDFFormat()
    {
      OutputFileName = filePath,
      Resolution = 300,
      DoCompressVectorGraphics = true,
      DoEmbedFonts = true,
      HasGeoRefInfo = true,
      ImageCompression = ImageCompression.Adaptive,
      ImageQuality = ImageQuality.Best,
      LayersAndAttributes = LayersAndAttributes.LayersAndAttributes
    };
    
    //Set up map series export options
    MapSeriesExportOptions MS_ExportOptions = new MapSeriesExportOptions()
    {
      ExportPages = ExportPages.Custom,  //Provide a specific list of pages
      CustomPages = "1-3, 5",  //Only used if ExportPages.Custom is set
      ExportFileOptions = ExportFileOptions.ExportAsSinglePDF,  //Export all pages to a single, multi-page PDF
      ShowSelectedSymbology = false  //Do no show selection symbology in the output
    };
    
    //Export on the worker thread
    await QueuedTask.Run(() =>
    {
      //Check to see if the path is valid and export
      if (MS_PDF.ValidateOutputFilePath())
      {
        layout.Export(MS_PDF, MS_ExportOptions);  //Export to PDF
      }
    });
    Export a map series to individual TIFF files
    //Export each page of a map series to an individual TIFF file.
    
    //Create TIFF format with appropriate settings
    TIFFFormat TIFF = new TIFFFormat()
    {
      OutputFileName = filePath,
      Resolution = 300,
      ColorMode = TIFFColorMode.TwentyFourBitTrueColor,
      HasGeoTiffTags = true,
      HasWorldFile = true,
      ImageCompression = TIFFImageCompression.LZW
    };
    
    //Set up map series export options
    MapSeriesExportOptions MSExportOptions_TIFF = new MapSeriesExportOptions()
    {
      ExportPages = ExportPages.All,  //All pages
      ExportFileOptions = ExportFileOptions.ExportMultipleNames,  //Export each page to an individual file using page name as a suffix.
      ShowSelectedSymbology = true  //Include selection symbology in the output
    };
    
    //Export on the worker thread
    await QueuedTask.Run(() =>
    {
      //Check to see if the path is valid and export
      if (TIFF.ValidateOutputFilePath())
      {
        layout.Export(TIFF, MSExportOptions_TIFF);  //Export to TIFF
      }
    });
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also