[Tutor] Windows Printing with separator sheets.

Faulconer, Steven M. STEVEN.M.FAULCONER at saic.com
Tue Nov 16 21:49:10 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. I posted this to the
Python-Win32 list, but didn't receive any response. I hope someone on the
Tutor list might have run into this before.

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 Tutor mailing list