如何使用python更改打印机首选项设置

2024-06-16 10:12:44 发布

您现在位置:Python中文网/ 问答频道 /正文

我是python新手,想更改打印机首选项设置。我正在使用win32print库,需要更改链接http://timgolden.me.uk/pywin32-docs/PyDEVMODE.html上给定的PyDEVMODE对象属性,具体如下要求。但是面临装箱问题。你知道吗

我试过这个-Python win32print changing advanced printer options

获取错误“未定义名称'pDevModeObj'”

PRINTER_DEFAULTS = {"DesiredAccess":win32print.PRINTER_ALL_ACCESS}  
pHandle = win32print.OpenPrinter('300LN1', PRINTER_DEFAULTS)  
properties = win32print.GetPrinter(pHandle, 2)  
pDevModeObj.Orientation = 2  
properties["pDevMode"]=pDevModeObj   
win32print.SetPrinter(pHandle,2,properties,0)

Tags: http链接打印机propertiesprintermedefaultsuk