Adding port close delay?

  • Thread starter Thread starter bryanfeir
  • Start date Start date
B

bryanfeir

Here's the situation:
* I have a printer which is connected via a virtual COM port
* The print spooler is told to print to this port
* The print spooler performs open/write/flush/close
* The 'flush' part returns success after the local COM port buffers
are
flushed, but before the remote printer buffers are flushed
* As a result, the 'close' causes still-buffered data to be dropped,
cutting off the end of the data being printed.

The ultimate solution is probably to fix the virtual COM port driver
to
properly verify that data is flushed all the way down the line.
However,
the likelihood of getting the ear of the vendor of said driver is low,
especially if they can shift the blame to someone else.

The simpler solution is to figure out some way to put a delay in the
spooler between the 'flush' and 'close'. A little experimentation
shows
that even one second delay should be sufficient. However, I can see
no
obvious way of doing that from the many options on the printer
properties
wizard, and I've tried just about every setting there already. Does
anybody know a registry setting that will cause the spooler to add a
short delay before closing a COM port?

Bryan Feir
 
Of course, the alternate approach is to add junk data to the end so
that the data dropped is not relevant. The 'End Print Job' command
in the Properties box only accepts 49 characters, which is not
enough. So the next question is, is there a way to make the print
separator page print at the end of the print job instead of the
beginning?

Bryan Feir
 
Back
Top