On 15/09/2010 11:04 PM, Jerzy Wolowik wrote:
I'm using Python 2.5.2 running on Win2k.


I've just try one of Tim Golden's "Win32 How Do I"
hints. Those on printing with win32print - Spooler API
wraper.


The problem? The problem is a huge delay in printing -
about two to four minutes. I'm printing to HP LJ 1320
connected via USB port or print server attached to
parallel port.


Here's the code:

import win32print
printer_name = win32print.GetDefaultPrinter ()
#
# raw_data could equally be raw PCL/PS read from
#  some print-to-file operation
#
raw_data = "This is a test"

hPrinter = win32print.OpenPrinter (printer_name)
try:
    hJob = win32print.StartDocPrinter (hPrinter, 1,
("test of raw data", None, "RAW"))
    try:
      win32print.WritePrinter (hPrinter, raw_data)
    finally:
      win32print.EndDocPrinter (hPrinter)
finally:
    win32print.ClosePrinter (hPrinter)

Can't see anything obvious. By sheer chance, since I'm
away from home at the mo, the only machine I have access
to is a Win2k machine with Python 2.5.2 on it attached to an
HP LaserJet 1018. I'm just downloading the pywin32 extensions
over a painfully slow ADSL line and I'll see if I can
reproduce.

I doubt very much if it's anything in the code; might *just*
be some bizarre thing to do with not pushing enough data
through the buffer although I would have thought that that
would have caused it *never* to print. Anyway...

TJG
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to