Using the PageLayoutControl

This topic discusses the PageLayoutControl and highlights working with elements, loading and saving map documents, and printing.

In this topic

About the PageLayoutControl

The PageLayoutControl corresponds to the layout view in ArcMap and encapsulates the PageLayout ArcObjects. Map documents authored with ArcMap can be loaded into the PageLayoutControl, eliminating the need to programmatically compose the cartography. See the following screen shot: 

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 and read map documents (*.mxd). The PageLayoutControl implements the IMxdContents interface that enables the MapDocument to write the contents of the PageLayoutControl to a new map document. See the following code example:
IMapDocument mapDocument = new MapDocument();
String ArcGISInstallDir = System.getenv("AGSDEVKITJAVA");
mapDocument.esri_new(ArcGISInstallDir + "java/samples/data/mxds/brazil.mxd");
mapDocument.setActiveView(pageLayoutControl.getActiveView());, 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 licensingDeployment licensing
Engine Developer KitEngine
ArcGIS for Desktop Basic
ArcGIS for Desktop Standard
ArcGIS for Desktop Advanced