ArcGIS Pro 2.8 API Reference Guide
PDFFormat Class
Members  Example 

ArcGIS.Desktop.Mapping Namespace : PDFFormat Class
Represents a Portable Document Format (PDF) object that can be used to export a MapView, MapFrame, or a Layout.
Syntax
public class PDFFormat : ExportFormat 
Public Class PDFFormat 
   Inherits ExportFormat
Remarks
PDF files are designed to be consistently viewable and printable across different platforms. They are commonly used for distributing documents on the Web and are becoming a standard interchange format for content delivery. PDFs are editable in many graphics applications and can retain annotation, labeling, and attribute data for map layers. PDF exports from support embedding of fonts and thus can display symbology correctly even if the user does not have Esri fonts installed.
Example
The following examples demonstrate how to export a Layout, a MapFrame, and a MapView to PDF format.
//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);
      }
    });
  }
}
Inheritance Hierarchy

System.Object
   ArcGIS.Desktop.Mapping.ExportFormat
      ArcGIS.Desktop.Mapping.PDFFormat

Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

PDFFormat Members
ArcGIS.Desktop.Mapping Namespace