|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Printing html
Is there a way to directly print generated html files without prompting the print setup form? Thanks in advance.
__________________
What can change the nature of a man? |
|
#2
|
||||
|
||||
|
I'n not sure exactly what you mean here, but if your generating a HTML file and want to print the contents of that file then you would do something like:
Code:
>>> print file('some/path/some.html').read()
...
Chances are that this isn't what you want, so a few more details about what you're doing would probably help .Have fun, Mark. |
|
#3
|
|||
|
|||
|
If you want instead see the file with a browser (for ex. Mozilla), from
which you can (if you want) see the html source... Code:
import os
os.system('mozilla some/path/some.html')
From the running browser, you can, of course, also send the file or the html source to a printer. If the command succeed (that is you have the browser in the execution path and the html file is present) a "0" is returned to the function "system". |
|
#4
|
|||
|
|||
|
Quote:
or use the webbrowser module ![]() Code:
import webbrowser
webbrowser.open_new("url")
|
|
#5
|
|||
|
|||
|
Thanks, but what I really wanted is to print (send the request to printer) without prompting the print setup dialog before the print. Let's say I'm generating a report, then after the report is done, I prompt a small message box (not print setup dialog), if ok, print immediately, else do nothing. Izzit possible?
Thanks in advance. |
|
#6
|
||||
|
||||
|
Assuming we're talking about a windows machine here then you're best bet would be to check out Mark Hammond's win32all extensions:
http://starship.python.net/crew/mhammond/ |
|
#7
|
|||
|
|||
|
I sure wish, lol, but it's in Linux, but thanks.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > Printing html |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|