如何从Python打印大小为5的word文档?

2024-04-27 00:36:00 发布

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

我在做一个程序,在word文档上打印收据。 我需要5号纸的打印件。你知道吗

这似乎是工作,但我不知道如何配置为A5大小。你知道吗

from win32com import client
import time

word = client.Dispatch("Word.Application")

def printWordDocument(filename):

    word.Documents.Open(filename)
    word.ActiveDocument.PrintOut()
    time.sleep(2)
    word.ActiveDocument.Close()

word.Quit()

Tags: from文档import程序clienttimeapplicationfilename