Change printer settings during printing.

 

In some situations it is required to change printer settings like; the file format, the output directory, the name of the generated image file, etc., based on a given requirement. The printer driver setting can be changed during printing, insuring that the printer driver will be configured to a given specification even if the user changes the printer driver setting through the Printing Preferences.

 

The printed document “Paper Size,” “Resolution,” and “Page Orientation” cannot be changed during printing. The Printing Application formats and prepares the Print Job based on this key parameters.

 

It is not recommended to change the Printer Driver Settings permanently during printing. The changes should only be applied for the current print job. The following functions should not be used:

 

·         BlackIceDEVMODE*     LoadBlackIceDEVMODE(LPCWSTR printername);

 

·         SaveDefaultBlackIceDEVMODE(LPWSTR szPrinterName, BlackIceDEVMODE* pDevMode);

 

·         ReplaceUserSettings(LPTSTR szPrinterName, BOOL bAllUsers);

 

·         ClearUserSettings(LPTSTR szPrinterName, BOOL bAllUsers);

 

·         BlackIceDEVMODE* CreateDefaultSettings(LPTSTR szPrinterName);

 

·         SaveBlackIceDEVMODE(LPWSTR szPrinterName, BlackIceDEVMODE* pDevMode);

 

 

The printer driver setting can be changed during printing through the:

            - Messaging Interface

            - The printer driver Plug-in feature.

 

Using Messaging Interface:

Printer Driver settings can be changed through the Messaging Interface for a single print Job or for a single page in the print Job. The Messaging interface is based on events. The Change DevMode events are fired before every StartDoc and StartPage events. The printer driver setting must be changed and implemented in Change DevMode event before StartDoc and for every StartPage event.

 

Using the Start Application feature with “Start for Messaging” option of the Printer Driver, the printer driver will wait for the application to start up and start processing the messages. The Start Application with the “Start Before Printing” option, will not be able to capture the printer driver messages. The time to start an application is Operating System and processor speed dependent.

 

For directions on how to use the Printer Driver messaging interface please see the following sections,” Message Capture Samples,” “Message Capture Service Samples,” and the “Changing the Output Directory through the API.” The “Changing the Output Directory through the API” sample, in the RTK, uses the Messaging Interface. The recommended message capture interface is the Pipe Interface.

 

Using printer driver Plug-in:

The printer settings can be changed based on some user interaction during printing.

-  Start Printing a Document to PDF format.

-  User will be prompted to enter password for the document.

-  User enters the password.

-  The PDF documented is generated with the password entered by the user.

Printer Driver settings can be changed in the BiPlugIn.dll by using the BiStartDocandBiStartPageevents in the BiPlugIn.dll. If a multi-page document is printed, changes to the printer driver setting must be applied to every pages BiStartPageevent. Printer Driver Plug-in feature is utilizing a Plug-in DLL.

 

For more information about creating an application using the BiPlugIn.dll with a user interface to interact with the printer driver, please see the documentation on the “BiPlugIn” Sample in the RTK.