[python-win32] Printing with a separator sheet?

Faulconer, Steven M. STEVEN.M.FAULCONER at saic.com
Thu Nov 11 16:54:29 CET 2004


Hello everyone,

I'm having a problem getting a stand-alone Windows system to print to a USB
printer with a separator sheet using Python+COM. The code is:

----code----
from win32com.client import Dispatch

myWord = Dispatch( 'Word.Application' )
#myWord.Visible = 1
myDoc = myWord.Documents.Add( r"c:\docs\report.doc" )
myDoc.PrintOut()
myDoc.Close()
----code----

Now, when I open that Word document (5 pages, text only) by hand and print.
Everything works correctly. The separator page is first, followed by the 5
page document. Running the above code gets the separator page to print, but
nothing else. If I uncomment Visible=1, I can see the instance of Word spool
5 pages. However, the printer only prints the separator sheet. Now, to
ensure it wasn't my separator sheet, using one of the separator pages that
comes with Windows (SYSPRINT.SEP) does exactly the same thing.

Has anyone encountered something like this before? Any help would be greatly
appreciated. Thanks.

Steven


More information about the Python-win32 mailing list