(Q) How can I change a report's printer programmatically?
(A) In order to change printer information, you must use APIs.
The PrtDevNames property stores the name of the printer, and the PrtDevMode
property stores the driver information. Both of these properties need to be changed in
order to change the printer driver. If the PrtDevMode property does not match the
PrtDevNames property (that is, the PrtDevMode property describes a different driver than
the PrtDevNames property) a General Protection (GP) Fault may occur.
Visit these links for more details and solutions.
How
to Change a Report's Printer Using Code (MS KB)
Controlling your printer (MS KB)
Download
the code (DefaultPrt.zip) from here (Courtesy of Ken Getz).
or, if you need ready code to pop into your application,
On
The Fly Printing (ATTAC Group)
|