ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Layouts Namespace / Layout Class / Export Method / Export(ExportFormat,MapSeriesExportOptions) Method
Specify one of the following ExportFormats.
Provide a set of MapSeriesExportOptions.
Example

In This Topic
    Export(ExportFormat,MapSeriesExportOptions) Method
    In This Topic
    Export pages from a layout's associated map series using a specialized collection of settings. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax

    Parameters

    exportFormat
    Specify one of the following ExportFormats.
    mapSeriesExportOptions
    Provide a set of MapSeriesExportOptions.
    Exceptions
    ExceptionDescription
    This method must be called within the lambda passed to QueuedTask.Run.
    Remarks

    This export overload allows you to export one or more pages associated with a map series to a supported output file format. Each ExportFormat has its own set of configurable parameters such as OutputFileName and Resolution.

    And you must also configure the MapSeriesExportOptions depending on the desired output.

    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);
          }
        });
      }
    }
    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);
          }
        });
      }
    }
    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);
          }
        });
      }
    }
    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);
          }
        });
      }
    }
    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);
          }
        });
      }
    }
    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);
          }
        });
      }
    }
    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);
          }
        });
      }
    }
    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);
          }
        });
      }
    }
    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);
          }
        });
      }
    }
    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);
          }
        });
      }
    }
    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 
    }
    PDF_lyt_Export
    await QueuedTask.Run(() => lyt.Export(PDF));
          
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also