Add a Custom Plug-in to the Black Ice Printer Drivers!
The Black Ice printer drivers include Custom Plug-In support which is accessed through a dynamic linked library or DLL, and is loaded by the printed driver during printing. The printer driver calls pre-defined functions from the Plug-in at each phase of printing, and will not continue printing until the function returns. Developers will have full access to the DLL and can insert their own custom code to each DLL function to perform a variety of tasks as required by their application.
The Black Ice printer drivers can convert any file printed from any Windows application into an image or PDF file, which can then be faxed, archived, etc. as necessary. Print Jobs can be submitted to the Black Ice printer drivers from either custom applications or from typical applications, such as Notepad or Microsoft Office applications. When using custom applications, developers can modify their printing application to perform exactly as they require, however when printing from a third party application, developer’s are at the mercy of the application vendor and the printing user. Until now…
How It Works
The Black Ice printer driver will load the Plug-In DLL with each print job and will pass to each DLL function a pointer to the devmode of the current print job. When the print job starts, at the Start Document phase, the Plug-In DLL can pass custom data to the printer driver. The custom data will be stored by the driver for the duration of the print job. The size of the custom data is not limited by the printer driver, however using a large data block is not recommended since the printing can be negatively impacted. Specifying a data block of no larger than 10-20 KB should be sufficient in most cases and will not have an impact on performance. The printer driver will return a pointer to the custom data in each additional function call to the Plug-in DLL. The Plug-in DLL can then modify or use the custom data in any way desired.
The Plug-in DLL functions must return TRUE on success or FALSE on any failure. If any of the custom functions return FALSE, the Black Ice Printer driver will abort the current print job.
Plug-in DLL functions:
The BiStartDoc() function will be called once for each print job, when the printer driver starts generating the images. The printer driver will pass the DEVMODE to the function and will allocate memory for the custom data passed back by the function.
The BiStartPage () function is called each time the printer driver starts processing a new page. The printer driver is passing the devmode and the custom data to the function.
The BiEndPage () function is called each time the printer driver finishes processing a page. The printer driver will pass the DEVMODE, the custom data and the current page number.
The BiEndDoc() function is called one for each print job when the printer driver each time the printer driver finishes processing a document. The printer driver will pass the DEVMODE, the custom data and the name of the group file. After the function returns the memory allocated for the custom data will be de-allocated.
The BiAbort() function is called if the print job is aborted, The print job can be aborted by the user, or by the printer driver if an error occurs.
Some Possible Uses
- Print Job Authorization – prompt for a username, password, etc. from the BiStartDoc function
- Display a custom database window for archiving applications – prompt for a database name, JobID, etc. from the BiStartDoc function
- Change printer driver settings on the fly (output directory, filename, etc)
- Alternate form of message handling - the printer driver will call a function of the DLL for each printing event which can be used to notify a developer’s application of the current printing status.