ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / MapView Class / Export Method / Export(ExportFormat,Camera) Method
Provides the information for the export output.
Defines the geographic area of the map to export. The current camera is used, when it's not provided.
Example

In This Topic
    Export(ExportFormat,Camera) Method
    In This Topic
    Export a mapview to a variety of formats. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public void Export( 
       ExportFormat exportFormat,
       Camera camera
    )
    Public Overloads Sub Export( _
       ByVal exportFormat As ExportFormat, _
       ByVal camera As Camera _
    ) 

    Parameters

    exportFormat
    Provides the information for the export output.
    camera
    Defines the geographic area of the map to export. The current camera is used, when it's not provided.
    Exceptions
    ExceptionDescription
    This method must be called within the lambda passed to QueuedTask.Run.
    File path must be valid and file must be accessible.
    Remarks
    Multiple examples are provided with each format derived from ExportFormat.
    Example
    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_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_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_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_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_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_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_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_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_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);
          }
        });
      }
    }
    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;
    //Export on the worker thread
      await QueuedTask.Run(() =>
      {
        MapView mv_bmp = mf_bmp.GetMapView(lytView);
        if (mv_bmp != null) { 
          //Check to see if the path is valid and export
          if (BMP.ValidateOutputFilePath())
          {
            mv_bmp.Export(BMP);  //Export to BMP
          }
        }
      });
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also