473,287 Members | 1,865 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

Print HTML from Python

Hi All,

I am at a loss. This is slightly OT because it concerns Windows and
HTML printing. I would like to print a HTML document from Python, but
not showing the printing dialog. After numerous searches and trials I
came to the conclusion that ShellExecute with the "print" command and
a HTML document simply always shows a print dialog, so that road is a
dead end (or unless someone can show me a snippet that does work).

I used win32com and I am able to print through he internet explorer
interface which seems to work, but quite unreliably. When I execute
the scipt too fast, nothing is printed at all. The method isBusy that
IE exposes through COM always returns False so there is no way to wait
reliably on the progress of the printer.

So basically my question is, does someone know a python lib or way to
print HTML to the default printer (I can get the printer name so even
that is not really needed) without showing the print dialog?

With regards,
- Jorgen
Jun 27 '08 #1
1 2150
On May 21, 3:45*am, "Jorgen Bodde" <jorgen.maill...@gmail.comwrote:
Hi All,

I am at a loss. This is slightly OT because it concerns Windows and
HTML printing. I would like to print a HTML document from Python, but
not showing the printing dialog. After numerous searches and trials I
came to the conclusion that ShellExecute with the "print" command and
a HTML document simply always shows a print dialog, so that road is a
dead end (or unless someone can show me a snippet that does work).

I used win32com and I am able to print through he internet explorer
interface which seems to work, but quite unreliably. When I execute
the scipt too fast, nothing is printed at all. The method isBusy that
IE exposes through COM always returns False so there is no way to wait
reliably on the progress of the printer.

So basically my question is, does someone know a python lib or way to
print HTML to the default printer (I can get the printer name so even
that is not really needed) without showing the print dialog?

With regards,
- Jorgen

Did you try all the methods on Tim Golden's site?

http://timgolden.me.uk/python/win32_how_do_i/print.html

I use the one at the bottom for PDFs. I never see a print dialog, but
it does leave Adobe running. If you're printing from Internet
Explorer, you might look at the PAMIE project.

http://pamie.sourceforge.net/

HTH

Mike
Jun 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Andrew Chalk | last post by:
In a Python 2.2 app. running under CGI the statements print "Hello\n" print "World" print both words on the same line in IE6. How do I print the second one on a new line (i.e. respect the \n...
6
by: Ruchika | last post by:
Hi, I am new to Python, so this may be a very simple question for most of you. What does the % operator stand for in Python? I came across a script that uses the % operator as follows - def...
14
by: Marcin Ciura | last post by:
Here is a pre-PEP about print that I wrote recently. Please let me know what is the community's opinion on it. Cheers, Marcin PEP: XXX Title: Print Without Intervening Space Version:...
2
by: jamesthiele.usenet | last post by:
I recently ran into the issue with 'print' were, as it says on the web page called "Python Gotchas" (http://www.ferg.org/projects/python_gotchas.html): The Python Language Reference Manual says,...
0
by: bearophileHUGS | last post by:
There is/was a long discussion about the replacement for print in Python 3.0 (I don't know if this discussion is finished): http://mail.python.org/pipermail/python-dev/2005-September/055968.html ...
69
by: Edward K Ream | last post by:
The pros and cons of making 'print' a function in Python 3.x are well discussed at: http://mail.python.org/pipermail/python-dev/2005-September/056154.html Alas, it appears that the effect of...
3
by: Hutch | last post by:
PythonWin has been a very good ide from early version thru 2.4. All work ok on THREE of my computers with THREE different HP printers. Now comes 2.5. Every thing seems to work the same except...
4
by: barronmo | last post by:
I'm a beginner searching for an easy way to print the contents of a text control. So far I've come up with the following(difficulties): 1) using wxPython -convert to HTML and then print (I...
1
by: RC | last post by:
By default the print statement sends to stdout I want to send to stderr Try print "my meeage", file=sys.stderr I got I try
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.