[英]How to tell the printer to print grayscale or colored content
I have this line of codes that will tell the printer to print a document. 我有这行代码,将告诉打印机打印文档。 But it will only print colored content. 但它只会打印彩色内容。
word = Dispatch("Word.Application")
word.Documents.Open(self.filePath)
word.ActiveDocument.PrintOut()
word.ActiveDocument.Close()
word.Quit()
What I want is to tell the printer to print grayscale content. 我要告诉打印机打印灰度内容。 Is there any possible solution for this? 有没有可能的解决方案?
Q: How to tell the printer to print grayscale or colored content? 问:如何告诉打印机打印灰度或彩色内容?
Short Answer: : 简短答案 :
You have to talk to the relevant printer driver, which is completely platform- and API-specific. 您必须与相关的打印机驱动程序进行交谈,该驱动程序完全是特定于平台和API的。
Longer Answer: 更长的答案:
The snippet you showed, word = Dispatch("Word.Application")
, is using a Python wrapper to Microsoft Com/ActiveX . 您显示的代码段word = Dispatch("Word.Application")
正在使用Microsoft COM / ActiveX的Python包装器。 Specifically, to the MS-Word COM/ActiveX component (which was presumably registered on your PC when you installed MS-Word). 专门针对MS-Word COM / ActiveX组件(在安装MS-Word时大概已在您的PC上注册)。
So all you have to do is look at the options provided by "Word.Application": 因此,您要做的就是查看“ Word.Application”提供的选项:
https://docs.microsoft.com/en-us/office/vba/api/word.application.printout https://docs.microsoft.com/en-us/office/vba/api/word.application.printout
Be advised, you might also have to play around with "Printer Device Settings", for example: 建议您可能还需要尝试“打印机设备设置”,例如:
https://docs.microsoft.com/en-us/office/vba/api/access.printer https://docs.microsoft.com/en-us/office/vba/api/access.printer
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.