Printing with the PageLayoutControl


Purpose
This sample demonstrates changing the PageLayoutControl's page properties and printing the page to the system default printer. The Browse dialog box allows you to search and select map documents, which are validated and loaded into the PageLayoutControl using the CheckMxFile and LoadMxFile methods. Whenever the FormID, Orientation, or PrinterToPageMapping properties of the page are changed, the number of pages to be printed is updated using the PrinterPageCount property. Before the PageLayout is sent to the printer using the Print method, the orientation of the printer's paper is aligned to that of the page's paper.

How to use

See How to use ArcGIS samples for help on compiling, setting up the debugger, and running the sample. If the sample has associated data, you will find that the sample's zip file includes a "data" folder alongside the language folders. However, you will need to update the sample to point to the location of the data once you have extracted all the files.

  1. Browse and select a map document to load into the PageLayoutControl.
  2. Change the page size, orientation, and printer to the page mapping properties.
  3. Before printing the page layout, specify the page range to be printed and whether there is to be any overlap between pages.

Additional information

Changing the page orientation or size can result in the map frame shrinking in relation to the page. This is dependant on the IPage.StretchGraphicsWithPage property.


AssemblyInfo.cs Assembly information.
PrintPageLayout.cs Form file.
Download the C# files
AssemblyInfo.vb Assembly information.
PrintPageLayout.vb Form file.
Download the VB.NET files

Download the files for all languages

See Also:

PageLayoutControl class
IPageLayoutControl interface




Development licensing Deployment licensing
Engine Developer Kit Engine
ArcGIS for Desktop Basic
ArcGIS for Desktop Standard
ArcGIS for Desktop Advanced