![]() ![]() ![]() Print PDF file in duplex mode via Python.Python's win32api only printing to default printer. ![]() Programmatically Print a PDF File - Specifying Printer.Here is a list of all the resources I checked out (examples not all in python, and a few are not using the win32api), and couldn't get the thing to work properly: When calling print(pDevModeObj.PaperSize)Įverything seems to be in order, so I'm guessing I don't know how to send those paper size values back to the printer settings. And when I try printing to a PDF printer, it also defaults to A4. Printers do not report a "paper size mismatch", like they should when a non-A4 document is being sent to them. Win32print.SetPrinter(pHandle,level,properties,0) PDevModeObj.PaperWidth = 1000 #SIZE IN 1/10 mm PDevModeObj.PaperLength = 2200 #SIZE IN 1/10 mm Properties = win32print.GetPrinter(pHandle, level) PHandle = win32print.OpenPrinter(printer, PRINTER_DEFAULTS) I got as far as the following code snippet, but I'm really stuck. All is relatively simple, save for getting the printers to register a custom paper size. I'm using reportlab to create temporary pdf files which I am then trying to send to the default printer. Recently, I was tasked with setting up print-automation onto the said forms from our central database. We are also using a bunch of custom-sized forms which people have up to now been filling in by hand. All are mainly used to print A4-sized documents, so the defaults are set up accordingly. At the organization I work for, different printers are set up at various locations. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |