ArcGIS Pro 2.7 API Reference Guide
LayoutFactory Class
Members  Example 

ArcGIS.Desktop.Layouts Namespace : LayoutFactory Class
Provides methods to create new layout project items.
Object Model
LayoutFactory ClassLayout ClassILayoutFactory Interface
Syntax
public class LayoutFactory : ILayoutFactory  
Public Class LayoutFactory 
   Implements ILayoutFactory 
Remarks

Creating a new layout simply generates a new layout project item that appears in the Layouts folder in the Contents pane. The next logical steps are to create new layout elements. Refer to the LayoutElementFactory to add new elements to layout.

A new layout project item is not automatically opened in a layout view pane. Use methods in the LayoutFrameworkExtender to open a layout project item in a pane.

Example
//This example creates a new layout using a minimum set of parameters.

//Added references
using ArcGIS.Desktop.Layouts;                    
using ArcGIS.Desktop.Framework.Threading.Tasks; 
using ArcGIS.Desktop.Core;

public class CreateLayoutEx1
{
  async public static Task<Layout> CreateBasicLayout(double width, double height, LinearUnit units, string LayoutName)
  {
    Layout layout = null;
    await QueuedTask.Run(() =>
    {
      layout = LayoutFactory.Instance.CreateLayout(width, height, units);
      layout.SetName(LayoutName);
    });

    //Open the layout in a pane
    await ProApp.Panes.CreateLayoutPaneAsync(layout);

    return layout;
  }
}
//This example creates a new layout using a CIM page definion with rulers and guides included.

//Added references
using ArcGIS.Desktop.Layouts;                      
using ArcGIS.Desktop.Framework.Threading.Tasks;    
using ArcGIS.Desktop.Core;
using ArcGIS.Core.CIM;

public class CreateLayoutEx2
{
  async public static Task<Layout> CreateCIMLayout(double width, double height, LinearUnit units, string LayoutName)
  {
    Layout CIMlayout = null;
    await QueuedTask.Run(() =>
    {
      //Set up a page
      CIMPage newPage = new CIMPage();

      //required
      newPage.Width = width;
      newPage.Height = height;
      newPage.Units = units;

      //optional rulers
      newPage.ShowRulers = true;
      newPage.SmallestRulerDivision = 5;

      //optional guides
      newPage.ShowGuides = true;
      CIMGuide guide1 = new CIMGuide();
      guide1.Position = 25;
      guide1.Orientation = Orientation.Vertical;
      CIMGuide guide2 = new CIMGuide();
      guide2.Position = 185;
      guide2.Orientation = Orientation.Vertical;
      CIMGuide guide3 = new CIMGuide();
      guide3.Position = 25;
      guide3.Orientation = Orientation.Horizontal;
      CIMGuide guide4 = new CIMGuide();
      guide4.Position = 272;
      guide4.Orientation = Orientation.Horizontal;

      List<CIMGuide> guideList = new List<CIMGuide>();
      guideList.Add(guide1);
      guideList.Add(guide2);
      guideList.Add(guide3);
      guideList.Add(guide4);
      newPage.Guides = guideList.ToArray();

      Layout layout = LayoutFactory.Instance.CreateLayout(newPage);

      layout.SetName(LayoutName);
    });

    //Open the layout in a pane
    await ProApp.Panes.CreateLayoutPaneAsync(CIMlayout);
    return CIMlayout;
  }
}
Inheritance Hierarchy

System.Object
   ArcGIS.Desktop.Layouts.LayoutFactory

Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

LayoutFactory Members
ArcGIS.Desktop.Layouts Namespace