在双面打印中打印字文档 [英] Printing in Duplexpage a word document

查看:693
本文介绍了在双面打印中打印字文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图自动执行在〜30 Word文档(* .doc)的双页打印两份副本的任务。我想发送程序转换为 .exe (我计划它只是为Windows计算机)使用 py2exe 。我知道我可以手动检查选项,但我不能够这样做的20台计算机,它将被使用,以及我不能安装在这台电脑的新软件(这就是为什么我想把它转换为 .exe )。

I am trying to automate the task of printing two copies at double page of ~30 Word document (*.doc). I want to send the program converted to .exe (I plan it just for Windows computers) using py2exe. I know that I can manually check the options but I will not be able to do so on the 20 or so computer where it will be used, as well as I cannot install in this computers new software (That's why I want to convert it into .exe).

我复制了这个解决方案打印,但我不能适应它做我想要的:

I copied this solution to print, but I can't adapt it to do what I want:

from win32com import client
import time

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

filename=input("What files do you want to print?")

def printWordDocument(filename):
    """Given a name of a file prints it. TODO: Add double page."""

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

    word.Quit()

我找不到任何选项以双页打印,或至少自动打印,PrintOut方法的双页的唯一选项是 ManualDuplexPrint ,在文档中说:True在没有双面打印套件的打印机上打印双面文档,但我不想使打印所有文档集更加容易。并且使程序可移植到其他计算机,而无需修改Word文档(我不创建它们)。

I couldn't find any option to print in double pages, or at least automatically, the only option of double page of PrintOut method is ManualDuplexPrint which in the documentation says: "True to print a two-sided document on a printer without a duplex printing kit.", but I don't want to make it even easier to print all the set of documents. And make a program portable to other computers, without modifying the Word documents (I don't create them).

任何其他方式吗?或其他任何选项吗?

Any other way to do it? Or any other option to do it?

UPDATE

代码在visual-basic(但),但如果我得到一个模板或一些提示,我想我会设法使适应我的条件的东西。

I am not able to code in visual-basic (yet), but if I get a template or some hints I think I will manage to make something adapted to my conditions.

推荐答案

我已经结束了一个宏,但这只适用于我自己的电脑,而不是所有的电脑应该工作。

I have ended doing a macro, but this just works for my own computer and not for all the computers where should work.

Sub Test()
'
' Test Macro
' Print in double page and 2 copies
'
    ActivePrinter = "Xerox WC 24 PCL"
    Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _
        wdPrintDocumentWithMarkup, Copies:=2, Pages:="", PageType:= _
        wdPrintAllPages, Collate:=True, Background:=True, PrintToFile:=False, _
        PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
        PrintZoomPaperHeight:=0
End Sub

这篇关于在双面打印中打印字文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆