Changing Printer Driver Settings Programmatically

 

Usually the user changes the printer settings manually from the User Interface (Printers > Printing Preferences), by selecting different options. However in some case the developer may need to change the printer settings to match their application’s requirements. The most common printer driver configuration requirements are:

 

·         Configuring the printer driver during installation.

·         Configuring the printer driver for a single print Job based on some criteria such as document name.

·         Configuring the printer driver for a user.

·         Configuring the printer driver for a every user.

·         Configuring the printer driver during printing after printing has started. For example if a PDF file is password protected one must enter the password after printing has started.

The Black Ice Resource Toolkit contains the BlackIceDEVMODE,OCX and BlackIceDEVMODE.DLL controls which provide developers with a tool allowing them to easily change any of the printer settings using VB, C/C++, Delphi, VB.NET, C#, etc. Using the BlackIceDEVMODE controls the developer simply has to call the appropriate function to change any printer setting to the desired setting.

 

For example, in order to change the output directory, the developer’s application should load the devmode using the LoadBlackIceDEVMODE () function, specify the new desired path using the SetOutputDirectory() function , and then save the settings to the printer using the SaveBlackIceDEVMODE() function. It is as simple as that. When a user opens the user interface or prints from an application, he will see and use the new output folder which was programmatically set by the application.

 

Changing the default settings of the printer driver must be done at installation time either by using the BlackIceDEVMODE controls or by modifying the INI file used by your installation project.

 

Changing Printer Driver Setting Before Printing

Configuring the printer driver during installation

Change the Output Directory through the API for a Print Job

Change printer settings during printing

Changing the printer driver settings for a user

Change the printer driver settings for every user

Change the printer driver settings Using Windows API

Change the printer driver settings though the API within the Installer

Change the printer driver setting in the InstallShield project