printing to file from MS Word

Tomaz Ficko tomaz.ficko at agroruse.si
Fri Oct 26 14:50:44 CEST 2001


I want to write a doc to ps converter. I'm using python 1.5.2 and
win32all-136.  The folowing code should do it:

    word = win32com.client.Dispatch('Word.Application')
    word.ActivePrinter = "HP LaserJet 5P/5MP PostScript"
    doc = word.Documents.Open(FileName=os.path.abspath('test.doc'))
    doc.PrintOut(PrintToFile=1, OutputFile='test.ps', Background=1)
    doc.close()
    word.quit()

But there is one problem. When I run this code it allways brings up file
dialog for the name of *.prn file. How can I disable this.

Tomaz





More information about the Python-list mailing list