|
Tech Note: The ImageMAKER Windows 95
Print Driver
The Print Capture Driver is designed to
easily integrate into any fax application. Three modules are defined: Print Driver, Fax File
API, and Control Dialog. ImageMAKER Print Capture is responsible for capturing print commands
to an in-memory bitmap (using Microsofts UNIDRV.DLL). The Fax File API, which
is integrated into the print driver, controls writing the bitmap to a TIF, BMP,
DCX, or PCX image file format. The Control Dialog provides the user interface, linking the
addressing, cover page generation, fax preview, and fax send functions to ImageMAKER Print
Capture operation. The Control Dialog is implemented as a separate executable, called at
start of printing, and it in turn controls the operation of ImageMAKER Print Capture. When
printing is complete, ImageMAKER Print Capture reports back to the Control Dialog the
status of the print job. To integrate ImageMAKER Print Capture into your environment, all
you need do is modify the Control Dialog. Plenty of source samples are provided in C, Visual Basic,
and Delphi.
To specify a Control Dialog
Executable, you may edit the supplied .INI file (\windows\IMGFAX.INI). The
.INI file tells ImageMAKER Print Capture which Control Dialog to call for
its instructions, and provides a list of defaults. These defaults can be
updated by the Control Dialog to influence the outcome of the print
job.
Note that in Windows 95, things written into the INI file do not stay
there. With the introduction of the registry in Windows 95, it became
the intent that all information would be stored there. This meant that printer information
could be stored on a per-printer basis, where the INI file perforce was per-driver.
In keeping with this philosophy, information from the INI file is copied into the registry
when it is first used.
Note that the name "Control Dialog" is a bit of a misnomer, which is
retained only for historical reasons. The original purpose of this
application was to put up a dialog which could be used by the end user to
enter details of the fax destination, and preview the FAX and his cover
sheet, which would be generated by the cover sheet generator. Many of our
current users actually don't want any dialog to show or have any user
intervention possible, for instance to handle server-side conversion. The
control dialog application is still optionally launched, but despite its
name it does not need to show a dialog.
The print capture driver is currently configured to support:
- 8 x 11, 8 x 14, A4, A3, and B4 sized paper
- Landscape and Portrait orientation
- Regular (204x98) and Fine (204x196) resolution;
higher and custom resolutions are available by special request
- TIF (Gamma, Brooktrout, Group 3 and 4, MH, MR),
DCX (Intel), PCX and BMP formats - PDF Scanned and PNG available
on request
- Multi-page files, or one page per file
Print Capture Integration
The following communication architecture is available
within IMGFAX.DRV to aid product integration with your custom application:
- On start of print, Print Capture reads the
contents of the IMGFAX.INI file
(but see below)
.
If no .INI file is found, Print Capture
prompts the user for the output file name.
- If IMGFAX.INI is found, and a ControlDialogEXE
file is specified, then print capture calls this executable, and waits
for a response message. The response message defines the name of the
file to output to, or returns an empty string (which forces the print driver
to check for DefaultFileName again).
- If ControlDialogEXE is not specified, then print
capture looks for DefaultFileName. If found, then it outputs to this
file
- If neither ControlDialogEXE or DefaultFileName is specified, then
print capture prompts for an output file name.
In Windows 95, the steps involved in looking for the INI file are as follows:
- Look in the printer-specific section of the registry for a particular setting.
- If there is a similar entry in the driver-specific INI file, copy it from the
INI file to the registry
- Erase the entry in the INI file.
We remove the information from the INI file so that it will only affect the next printer
accessed. The intent is to take the information out of a driver-specific space and into a
printer-specific storage area. Once the information has been removed from the INI file, it can
be retrieved from the registry at
HKLM/
System/
CurrentControlSet/
Control/
Print/
Printers/
<Printer Driver Name>/
PrinterDriverData
All the data is stored as REG_SZ (string) types using the names of the keys as shown in the INI
file section above. So for instance, the [CSID] Enable entry in the INI file will appear
in the registry with the value name "Enable".
Note the one exception to this: the settings in the [Debug] section of the INI file
are never copied into the registry, and are never checked in the registry.
Included with ImageMAKER Print Capture is a sample Custom Control Dialog application
IMG16DLG.EXE (Visual C Example) which is called by ImageMAKER Print Capture. Source to
this application is provided as part of the object license.
The application makes a call to IMG16MFX.DLL to
handle communication with the ImageMAKER Print Capture Driver. The
Control Dialog
may also communicate with the driver by updating fields in the IMGFAX.INI file (file
type, break pages, default file name). When ImageMAKER Print Capture has completed the print
capture process, it notifies the Control Dialog with a status message, including number of
pages written or error return code. The maximum number of lines per page may
be requested by a call to another routine; this can be used to determine
whether the image sent was high or low resolution.
Supported fields within the \windows\IMGFAX.INI file are as follows:
[OWNER]
ControlDialogEXE=Installation_dir\img16dlg.exe
DefaultFileName=Installation_dir\ifax.tif
FileType=0
BreakPages=1 ShadowFile=0 DelayedCancel=0 Language=0 LeftMargin=0 ForceSubType=0 PadLines=0 NoRotation=0 OverwriteIfFileExists=1
[CSID] OwnerName="" OwnerNumber="" Enable=0
[DEBUG] DisplayStatus=0 DisplayFileErrors=0 LogFileName=C:\temp\imgfax.log
The values of these settings are:
- ControlDialogEXE: The fully-qualified name of
the program to be invoked as the control dialog. May be left blank if
none.
Note that in Windows 95, this must be the SHORT NAME of the application, as it is
used by the driver, which is 16-bit code and doesn't know about longnames.
- DefaultFileName: The fully-qualified name of the
file to be generated, by default. The control dialog can override this
at will.
Note that in Windows 95, this must be the SHORT NAME of the application, as it is
used by the driver, which is 16-bit code and doesn't know about longnames.
- FileType: This controls the output file type
generated by the driver. Values available are:
- -1: No output will be generated
- 0: TIFF MH, image bits reversed (default, what GammaFax cards
expect)
- 1: TIFF MH, image bits in normal order
- 2: Intel DCX
- 3: ZSoft PCX
- 4: TIFF MR 2D, image bits reversed
- 5: TIFF MR 2D, image bits in normal order
- 6: TIFF MMR (G4), image bits reversed
- 7: TIFF MMR (G4), image bits in normal order
- 8: TIFF PackBits
- 10: Monochrome BMP
- BreakPages: For TIFF files, if set to 0 will
generate multi-page TIFF.; if set to 1 will generate individual images
for each page.
- ShadowFile: For debugging; if set to 1, will open a second file
having the same name as the image file being generated, and the
extension .DMP, which will contain the text strings that the driver has
been asked to render.
- DelayedCancel: Some applications can't handle a Cancel response from
the driver; some versions of Outlook, for instance, fail to see that a
cancel from the print driver has occurred, and will fail with a GPF.
Setting this switch to 1 postpones acting on the Cancel response until
the document completes. This switch may no longer be required.
- Language: When the driver is built to accept external resource
libraries, and an external resource library is present, this selects
which language in the resource library will be used for strings and
dialogs. Contact ImageMAKER tech support for details.
- LeftMargin: The printer as it normally ships has no unprintable area
on any side of the page. Some programs generate reports starting at the
edge of the printable area; these reports, printed to our Print Capture
driver, will be pushed up hard against the left edge of the paper and
may be truncated Some drivers are built to allow setting a left margin;
for those printers, you can specify here a number of pixels (at 204 to
the inch), and the entire generated image will be shifted by the
specified amount.
- ForceSubType: This switch controls the use of
the TIFF NewSubType flag, and is set to ensure Commetrex compatibility.
It has three values:
- 0: Single-page TIFF files have the NewSubType tag value set to 0
to indicate that they are single page, multi-page TIFF files have this
flag set to 2 to indicate multi-page (as per TIFF specification)
- 1: All TIFF files have the NewSubtype tag value set to 0
- 2: All TIFF files have the NewSubtype tag value set to 1
(required for Commetrex modems)
- PadLines: If this value is set, the page size is rounded up to the
specified number of lines. For instance, if PadLines is set to 8,
extra white lines will be added to the image until the total number
of lines in the image is equal to 8.
- NoRotation: If 0, landscape images are rotated
90° to fit a standard FAX machine. If 1, no rotation is done.
- OverwriteIfFileExists: Controls handling files
that have the same name as existing files. This switch can have three
values:
- 0: The driver will pop up a dialog box asking the user for a
new file name.
- 1: The existing file will be over-written.
- 2: If the file type is one for which adding additional pages makes
sense (e.g. multi-page TIFF), the new pages will be appended to
the existing file. If appending new pages is not supported, the driver
will pop up a dialog, as in case 0.
- OwnerName: The text string printed across the
top of the page as the CSID
- OwnerNumber: The phone number printed across the top of the page as
the CSID
- Enable: If set to 1, the CSID is printed. If set
to 0, it is not.
- DisplayStatus: If set to 1, a log file is
generated indicating all decision points in the driver. This is not
useful generally except when debugging a specific drver problem with the
assistance of ImageMAKER Development.
- DisplayFileErrors: If set to 1, a log file is generated detailing
any file system errors that occur.
- LogFileName: The name of the log file generated
if DisplayStatus or DisplayFileErrors is set. This defaults to
"c:\temp\faxdrv.log" if it does not appear in the INI file.
Note that in Windows 95, this must be the SHORT NAME of the application, as it is
used by the driver, which is 16-bit code and doesn't know about longnames.
Specific Known Issues
and Workarounds
Excel and the Overwrite Flag
Microsof Excel will occasionally, for no reason that
we can see, break a single printout into two or more print jobs. The
Overwrite flag was specificaly altered to handle this situation; a second
printout having the same name can be assumed, usually, to be an additional
section of the same print job, and should be appended to the previous job.
The control dialog can be set up to have some persistence of data
structures, so that it knows that an additional print job has been
generated by Excel, and appends the two print jobs, only sending the
appended set of jobs off when they are complete. Our suggestion for this
is to wait for 10 seconds to see if there is another print job; Excel
seems to launch its print jobs in short order after it has managed to get
all its ducks in a row.
Adobe Acrobat, Aldus PageMaker, Microsoft Office 97
(pre SP-1) and Corel WordPerfect 6 and 7
These applications do their own font handling and do
not seem to be able to handle printer pixels that are not quite square.
Microsoft Office 97 actually replaced a Windows component that could
handle non-square pixels with one that could not; this is one
reason that a service release of Office 97 had to be made. If you must
produce printouts with these applications, and are getting unuseable
output because of this problem, we have a special square-pixel driver
(200x200 instead of 204x198) that will eliminate the problem. Contact for
details.

|