Black Ice Printer Drivers - Maintain the
same input and output filenames
The Black
Ice printer driver supports seven filename generation
methods:
-
Use the
prefix and extension
-
Prefix
and extension from the registry
-
Prefix
and extension from the INI file
-
Exact
filename
-
Exact
filename from the registry
-
Exact
filename from the INI file
-
Use the
document name
In the past, the “Use the document name” has created some
confusion among our customers. Many developers, when
printing programmatically to the Black Ice printer, would
like to use the file name of the original printed document
as the file name of the generated image file. This is not
directly possible since printer drivers are not aware of the
name of the file printed by the printing application. When a
printer driver prepares the print job, the printing
application can pass a string to the printer driver
specifying the document name, but in most cases that is not
the same as the actual file name. For example if Word prints
a file called test.doc, the document name passed by Word to
the printer driver will be “Microsoft Word – test.doc”.
But there is hope! Using the BlackIceDEVMODE.dll or
BlackIceDEVMODE.ocx controls, developers can solve this
issue in a few steps.
1. When printing is done automatically, the printing
application knows the name of the file which is going to be
printed. Before printing, the application must read the name
of the source file.
2. Once you have the name of the source file, use the
BlackIceDEVMODE.dll or BlackIceDEVMODE.ocx controls to
change the filename generation method to “Use exact
filename” and set the output file name using the
SetImageFileName() function to the desired file name.
Cutting the extension of the original file, and replacing it
with the file extension for the current file type can create
the desired file name. Use the GetFileExtension() function
to get the current file extension for the currently used
file format.
Using these simple steps it is possible to create images
having the source document’s name. The latest Black Ice
Printer Driver RTKs includes a simple sample application
which demonstrates the above steps and can be used as a
starting point for implementing this functionality in your
own application. |