[python-win32] Generating Postscript from Word

Bob Gailer bgailer at alum.rpi.edu
Tue Apr 22 16:18:14 EDT 2003


At 09:24 PM 4/22/2003 +0100, Paul Browning wrote:



>--On 22 April 2003 13:49 -0600 Bob Gailer <bgailer at alum.rpi.edu> wrote:
>
>>>However, I'd like to generate Postscript silently from Word. Doing
>>>
>>>myWord.ActivePrinter = 'Apple LaserWriter 16/600 PS'
>>>
>>>selects the right driver but I how do I pass a filename
>>>for the output so as to avoid the dialogue box that
>>>pops up?
>>
>>doc = myWord.Documents.Add('f:\\tests\\test1.doc')
>>myWord.doc.PrintOut()
>>
>>Make friends with the object browser in the visual basic editor under
>>word. You could look up PrintOut and see which objects it applies to.
>
>Wow - thanks. That's a voyage of discovery. I guess this is the right info:
>
>Sub PrintOut([Background], [Append], [Range], [OutputFileName], [From],
>[To], [Item], [Copies], [Pages], [PageType], [PrintToFile], [Collate],
>[FileName], [ActivePrinterMacGX], [ManualDuplexPrint], [PrintZoomColumn],
>[PrintZoomRow], [PrintZoomPaperWidth], [PrintZoomPaperHeight])
>
>So I should do something like:
>
>myWord.PrintOut(FileName='f:\\tests\\test1.ps', PrintToFile=1)
>or
>myWord.PrintOut(OutputFileName='f:\\tests\\test1.ps', PrintToFile=1)

Please review my code above (myWord.doc.PrintOut()) . You should use the 
PrintOut() method of the document object not the application object..

Bob Gailer
bgailer at alum.rpi.edu
303 442 2625
-------------- next part --------------

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.467 / Virus Database: 266 - Release Date: 4/1/2003


More information about the Python-win32 mailing list