New tips on printing in Windows NT/2000/XP
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- Date: Mon, 17 Dec 2001 10:30:50 -0800 (PST)
- From: Bob Rasmussen <ras@xxxxxxxxxx>
- Subject: New tips on printing in Windows NT/2000/XP
I'm writing to share some new things I've learned about how Windows NT/2000/XP
handles low-level printing. This is applicable to our software products
(Anzio, PrintWizard), and also to other programs and environments that do
low-level printing as described below.
The approach to printing that Windows offers programmers consists of drawing
graphic objects, such as text, pictures, lines, etc., on a page. I refer to
this as high-level printing. However, many older software environments need to
print by simply sending a stream of characters, and possibly escape sequences
(to set character pitch, paper orientation, etc.), to the printer. There are
various ways to do this in Windows (as a programmer); I will focus on two,
which I call Spooler and Raw. Both these methods allow data including escape
sequences to go to the printer without alteration.
The Spooler approach consists of writing the data to the Windows spooler, for
a particular printer. The spooler settings for that printer dictate when the
print job will begin and end printing.
The Raw approach consists of writing the data directly to a file/device named
LPT2 or COM1, for example. In Windows 9X (95, 98, ME) this data goes directly
to the port, as one would expect, and so is printed immediately. In
NT/2000/XP, however, it behaves differently, and that is the focus of this
RAW PRINT IN NT/2000/XP
The behavior of NT (etc.) depends, I have learned, on whether there is a
printer defined for that port. Suppose, for example, that you have just
plugged a new dot matrix printer into LPT2, but have not installed a printer
driver for it. Then you run a program that writes to LPT2.
(In Anzio, you can set "File:Print Level" to "Raw", and in "Raw Setup", enter
"LPT2". Then print something.)
The printer behaves as expected. Data sent to the printer is printed
immedately, even if the print job has not been terminated. That is, you can
have "print as you go". So far so good.
Now you tell Windows that you have a printer, of whatever kind, installed on
LPT2. Everything changes. Now when you send data to LPT2, it gets captured and
redirected to that printer's spooler. (I believe the intent is that DOS
programs printing to LPTn will now "play nice", and share the printer with
other programs.) Consequently, it may not start printing right away, and it
may not print everything until the program terminates the print job. The
behavior is in fact governed by the spooler settings for the associated
printer driver. You can find these settings in the printer's "Properties"
dialog, under the "Scheduling" or "Advanced" tab. There you can choose to
"Spool print documents..." (with a couple of sub-options), or you can choose
to "Print directly to the printer".
THE PROBLEM AND HOW TO SOLVE IT
The problem I hear of most frequently is that there is a delay in printing, at
either a Spooler or a Raw level. You can remove the delay with the following
1. If printing at a Spooler level, change the spooler settings in the printer
driver to "Print directly to the printer".
2. If Printing at a Raw level, on Windows NT/2000/XP, check to see whether a
printer is defined on the port in question. Assuming one is, you have these
2a) Set that printer's spooler settings to "Print directly to the printer".
2b) Delete that printer, in the "Printers" box in Windows, if you don't
need to print to it in other ways.
(Also, in Anzio, set your Flush Timer to a lower level.)
I hope this helps.
....Bob Rasmussen, President, Rasmussen Software, Inc.
personal e-mail: ras@xxxxxxxxxx
company e-mail: rsi@xxxxxxxxxx
voice: (US) 503-624-0360 (9:00-6:00 Pacific Time)
fax: (US) 503-624-0760