By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 1,109 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

printing word(.doc) documents and from internet explorer..

P: 8
hello again..i've been searching for quite some time now already looking for a solution to printing word documents with python..same thing for internet explorer..i was experimenting around with some code and all i came up was how to print pdf and text files with python using adobe reader 7.0 and notepad..i want to know how to do it with word and internet explorer..can someone help me out?here is the code i came up with for printing pdf and text files :)

Expand|Select|Wrap|Line Numbers
  1.  
  2. os.system ('"C:\Program Files\Adobe\Acrobat 6.0\Reader\AcroRd32.exe"'  + ' /p /h ' + 'test.pdf')
  3. os.system ('"exit"')
  4. os.system ('"notepad.exe"'  + ' /p ' + 'text.txt ')
  5.  
  6.  
this is the simple script i tested around with to print pdf files and then text files after its done with the pdf..thanks a lot in advance..
Feb 28 '07 #1
Share this Question
Share on Google+
3 Replies


bartonc
Expert 5K+
P: 6,596
hello again..i've been searching for quite some time now already looking for a solution to printing word documents with python..same thing for internet explorer..i was experimenting around with some code and all i came up was how to print pdf and text files with python using adobe reader 7.0 and notepad..i want to know how to do it with word and internet explorer..can someone help me out?here is the code i came up with for printing pdf and text files :)

Expand|Select|Wrap|Line Numbers
  1.  
  2. os.system ('"C:\Program Files\Adobe\Acrobat 6.0\Reader\AcroRd32.exe"'  + ' /p /h ' + 'test.pdf')
  3. os.system ('"exit"')
  4. os.system ('"notepad.exe"'  + ' /p ' + 'text.txt ')
  5.  
  6.  
this is the simple script i tested around with to print pdf files and then text files after its done with the pdf..thanks a lot in advance..
Any program that you can find the command-line arguments for (as you have here) will behave this way. The usual way to do this with Word or IE is to use the PythonWin extentions. The problem I have with this technique is that you then need to know the Visual Basic commands to send to the application. For IE there is also the CPAMIE module. Do some searches of TheScripts for either of these.
Feb 28 '07 #2

P: 8
i did command line printing for word and internet explorer before i tried it on python but they don't print at all..word only opens the file and doesn't print and ie doesn't open the file at all but instead prints an error message onscreen..i will try look around more..i hope im going to get the solution to this..thanx b..
Feb 28 '07 #3

bartonc
Expert 5K+
P: 6,596
i did command line printing for word and internet explorer before i tried it on python but they don't print at all..word only opens the file and doesn't print and ie doesn't open the file at all but instead prints an error message onscreen..i will try look around more..i hope im going to get the solution to this..thanx b..
Sorry, crashonyou, my internet connection has been terible this past week.
PythonWin's COM Client are probably the way to go here.
Mar 2 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.