win32print - adding some APIs?
Alan Miller
ajm at enteract.com
Wed Jun 28 16:30:09 EDT 2000
[forgive me, I'm a wordy SOB]
I've run into a semi-interesting situation where I need to tweak code
that's completely ready to go to the printer - PCL in this case, but the
basic problem could apply to just about anything. The problem is that
once I modify the data stream, I don't have a good generic way to get it
to the printer - I can open up the printer share for writing (for shared
printers, which covers most of what I'm addressing currently) and send it
there, but it would be nice to have the ability to send data to a non-
shared printer as well.
What I'm wondering is what it would take to extend win32print? As it
currently stands it looks like it's pretty basic - OpenPrinter with a
printer name to get a handle, GetPrinter to get some information about
the printer, ClosePrinter to close the handle out again. No way to deal
with actual print jobs that I can see unless the handle is usable as a
device context handle for printing with win32ui.
The things I see missing are StartDocPrinter and EndDocPrinter, along
with WritePrinter to actually get data to it. Is sending data directly
to the printer or queue without going through the Windows drivers
something that people have considered or would find useful?
If nobody else is interested I can maybe take a hack at the source, but
my current C++ experience is pretty much limited to modifying existing
code (appropriate here) and I'm not quite sure what the procedure would
be for getting changes incorporated....
I do have a VB class that I put together to do this, but it seems silly
to create an ActiveX server in VB so that I can use it from Python to get
to the Windows APIs. Inelegant, you might say. On the other hand, I'd
love to convert that into Python code if I can get to the APIs.
Any thoughts?
ajm
More information about the Python-list
mailing list