How to print multiple copies of a file using win32com (or an alternative)

独自空忆成欢 提交于 2019-12-13 18:21:13

问题


I'm trying to send multiple copies of a file to a printer using the win32com library. 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).

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.

If there is a superior way to just open and then print a .docx file from python that would also be a wonderful answer. Thanks!


回答1:


I've had the exact same problem, it seems the win32com module doesn't take those parameters into account. You could simply execute it twice if 2 copies is all you want, but for other parameters like PrintZoomColumn it would prove a problem.



来源:https://stackoverflow.com/questions/27951496/how-to-print-multiple-copies-of-a-file-using-win32com-or-an-alternative

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!