ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Desktop.Layouts Namespace / Layout Class / SetPage Method / SetPage(CIMPage) Method
CIMPage
Example

In This Topic
    SetPage(CIMPage) Method
    In This Topic
    Applies the changes made to a modified CIMPage to the layout. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public void SetPage( 
       CIMPage page
    )
    Public Overloads Sub SetPage( _
       ByVal page As CIMPage _
    ) 

    Parameters

    page
    CIMPage
    Exceptions
    ExceptionDescription
    This method must be called within the lambda passed to QueuedTask.Run.
    Example
    Layout_GetSetPage
    //Modify a layouts page settings.
    
    //Perform on the worker thread
    await QueuedTask.Run(() =>
    {
    
      CIMPage page = layout.GetPage();
    
      //Do something 
    
      layout.SetPage(page);
    });
    Change the layout page size
    //Change the layout page size.
    
    //Reference the layout project item
    LayoutProjectItem lytItem = Project.Current.GetItems<LayoutProjectItem>()
                             .FirstOrDefault(item => item.Name.Equals("MyLayout"));
    if (layoutItem != null)
    {
      await QueuedTask.Run(() =>
      {
        //Get the layout
        Layout lyt = lytItem.GetLayout();
        if (lyt != null)
        {
          //Change properties
          CIMPage page = lyt.GetPage();
          page.Width = 8.5;
          page.Height = 11;
    
          //Apply the changes to the layout
          lyt.SetPage(page);
        }
      });
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also