ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Layouts Namespace / Layout Class / SetPage Method / SetPage(CIMPage,Boolean) Method
CIMPage
Scale the elements to fit the new page size
Example Version

SetPage(CIMPage,Boolean) Method
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,
   bool resizeElements
)

Parameters

page
CIMPage
resizeElements
Scale the elements to fit the new page size
Exceptions
ExceptionDescription
This method must be called within the lambda passed to QueuedTask.Run.
Example
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.1 or higher.
See Also