ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Layouts Namespace / Layout Class / GetPage Method
Example

In This Topic
    GetPage Method
    In This Topic
    Gets the CIMPage for a layout. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public CIMPage GetPage()
    Public Function GetPage() As CIMPage

    Return Value

    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