See Using the samples for help on compiling, setting up the debugger, and running the sample (either an exe or dll).
Download the appropriate files to the directory of your choice.
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.
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.