Printing with the PageLayoutControl


PurposeThis sample demonstrates changing the PageLayoutControl's page properties and printing the page to the system default printer. The Browse dialog box allows users 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.

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

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

How to use

See Using the samples for help on compiling, setting up the debugger, and running the sample (either an exe or dll).

  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.

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