[英]How to print multiple copies of a file using win32com (or an alternative)
I'm trying to send multiple copies of a file to a printer using the win32com library. 我正在尝试使用win32com库将文件的多个副本发送到打印机。 Printing a single copy works fine, but it appears the Copies parameter doesn't affect the number of copies printed (even if I put Copies=2, as below, it only ever prints out a single page).
打印单个副本可以很好地工作,但是看起来Copies参数不会影响打印的副本数量(即使我将Copies = 2设置为如下所示,它也只能打印出一页)。
from win32com import client
word = client.Dispatch("Word.Application")
word.Documents.Open(file_to_print)
word.ActivePrinter = printer
word.ActiveDocument.PrintOut(Copies=2)
word.ActiveDocument.Close()
word.Quit()
If this additional information helps, I am using Python 3.4 and Word 2013. 如果这些附加信息有帮助,我正在使用Python 3.4和Word 2013。
If there is a superior way to just open and then print a .docx file from python that would also be a wonderful answer. 如果有一种更好的方法来打开然后从python打印.docx文件,那也是一个很好的答案。 Thanks!
谢谢!
I've had the exact same problem, it seems the win32com module doesn't take those parameters into account. 我遇到了完全相同的问题,似乎win32com模块没有考虑这些参数。 You could simply execute it twice if 2 copies is all you want, but for other parameters like
PrintZoomColumn
it would prove a problem. 如果只需要2个副本,则只需执行两次即可,但是对于其他参数(如
PrintZoomColumn
这将是一个问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.