Modify map page and printer


PurposeThis document demonstrates how to use the page, paper, and printer objects when changing a map's page size or assigned printer. It also shows one way to automatically reassign the printer when a map document is saved with an invalid printer.

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

Additional Requirements
  • A printer with the manufacturer's driver for Windows installed
  • Map documents (.mxd files) in a folder that need to have their printer reference changed

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. Download the appropriate files to the directory of your choice.
  2. Open the solution file to open the project. In the source file (Program.cs or ChangeMapPageSize.vb) the sNewPrinterName should be changed to reflect the name of the printer you want to switch to.
  3. Additionally, sDocName and sDocPath should be changed to reflect the name and path of the .mxd file to be opened and modified. These values can be parameterized if this example code is used in a larger application.

ChangeMapPageSize/Program.cs The code for this sample in CSharp
Download the C# files
ChangeMapPageSizeVB/ChangeMapPageSize.vb The code for this sample in Visual Basic .NET
Download the VB.NET files

Download the files for all languages

See Also:

Output library overview