Using PageLayoutControl


Summary This article provides an overview of the PageLayoutControl and highlights working with elements, loading and saving map documents, and printing.

In this topic


Introducing the PageLayoutControl

The PageLayoutControl corresponds to the layout view of the ArcMap desktop application and encapsulates the PageLayout ArcObject. Map documents authored with ArcMap can be loaded into the PageLayoutControl, eliminating the need to programmatically compose the cartography. 

Loading map documents

The map document can be set at design time through the PageLayoutControl property pages (in development environments that support property page capability).
Alternatively, a map document can be loaded into the PageLayoutControl programmatically using the checkMxFile() method to determine whether the document is valid and the loadMxFile() method to load the map document.

Saving map documents

The PageLayoutControl can write map documents (*.mxd) as well as read them. The PageLayoutControl implements the IMxdContents interface that enables the MapDocument ArcObject to write the contents of the PageLayoutControl to a new map document. See the following code snippet:
[Java]
IMapDocument mapDocument = new MapDocument();
String ArcGISInstallDir = System.getenv("ARCGISHOME");
mapDocument.esri_new(ArcGISInstallDir + "java/samples/data/mxds/brazil.mxd");
mapDocument.replaceContents((IMxdContents)pageLayoutControl.getObject());
mapDocument.setActiveView(pageLayoutControl.getActiveView());
mapDocument.save(true, true);

Managing elements

The PageLayoutControl provides shortcuts to frequently used methods, such as getGraphicsContainer() and addElement(), and helper methods, such as findElementByName()and locateFrontElement(), to manage individual elements in the PageLayout.

Printing tasks

The PageLayoutControl also provides shortcuts to frequently used Page and Printer ArcObjects through helper methods, such as setPrinterByRef(), setPageLayoutByRef(), and printPageLayout(), to assist with printing tasks.


See Also:

Controls library overview
Working with the page layout
How to get started with the PageLayoutControl property pages
Sample: PageLayoutBean, TOCBean, ToolbarBean




Development licensing Deployment licensing
Engine Developer Kit Engine Runtime
ArcView
ArcEditor
ArcInfo