[python-win32] win32print.StartDocPrinter

Anthony Sterrett vl.arandur at gmail.com
Wed Jul 6 20:23:08 CEST 2011


What are the available data types accepted by *tuple* in
win32print.StartDocPrinter(*hprinter, level, tuple*)? Or, if this is
determined by my printer driver, how can I find this information?

I am trying to hack together a program that will print a html file I've
generated onto a 3x5 index card... code below:

def print_data(data):
    pHandle = OpenPrinter(GetDefaultPrinter(),
{"DesiredAccess":PRINTER_ALL_ACCESS})
    devmode = GetPrinter(pHandle, 8)["pDevMode"]
    devmode.PaperLength = 1270
    devmode.PaperWidth = 762
    SetPrinter(pHandle, 8, {"pDevMode":devmode}, 0)
    hJob = StartDocPrinter(pHandle, 1, ("spellcard.html", None, "RAW"))
    StartPagePrinter(pHandle)
    WritePrinter(pHandle, data)
    EndPagePrinter(pHandle)
    EndDocPrinter(pHandle)
    ClosePrinter(pHandle)

So what I'm really asking, if anyone can answer, is this: How do I turn my
HTML file into something I can print?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20110706/90860e4b/attachment.html>


More information about the python-win32 mailing list