"Raja" <[EMAIL PROTECTED]> wrote: > Hi, > Attached is the code . I want my program to save the current printer > job properties and , when I reconnect the printer at a latter date , i > need to print the saved job . Can you please help with my code ? How > to print a document at a later stage and any errors in my code ? > > import win32ui > import win32con > > myprinter_name = "" > # get the name from your Printers folder > > printer_properties=[] > > def save(): > pHandle = win32print.OpenPrinter(myprinter_name) > properties = win32print.GetPrinter(pHandle, 2) > pDevModeObj = properties["pDevMode"] > printer_properties.append(pDevModeObj.FormName) > printer_properties.append(pDevModeObj.PaperSize) > printer_properties.append(pDevModeObj.Orientation) > printer_properties.append(pDevModeObj.Color) > printer_properties.append(pDevModeObj.Copies) > printer_properties.append(pDevModeObj.DefaultSource) > win32print.ClosePrinter(pHandle) > > def apply(): > hprinter = win32print.OpenPrinter(myprinter_name) > > devmode = win32print.GetPrinter(hprinter, 2)["pDevMode"] > devmode.FormName=printer_properties[0] > devmode.PaperSize=printer_properties[1] > devmode.Orientation=printer_properties[2] > devmode.Color=printer_properties[3] > devmode.Copies=printer_properties[4] > devmode.DefaultSource=printer_properties[5] > > hdc = win32gui.CreateDC("WinPrint",myprinter_name,devmode) > dc = win32ui.CreateDCFromHandle(hdc) > > dc.StartDoc('My Python Document') > dc.StartPage() > dc.EndPage() > dc.EndDoc() > del dc > > > You help is greatly appreciated. > > Thank You, > Raja. >
You should be able to pause the job using win32print.SetJob with JOB_CONTROL_PAUSE and resume it later using JOB_CONTROL_RESUME. That way you won't even have to store the print parameters yourself. hth Roger ----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups ----= East and West-Coast Server Farms - Total Privacy via Encryption =---- -- http://mail.python.org/mailman/listinfo/python-list