Print HTML from Python

Discussion in 'Python' started by Jorgen Bodde, May 21, 2008.

  1. Jorgen Bodde

    Jorgen Bodde Guest

    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
    Jorgen Bodde, May 21, 2008
    #1
    1. Advertising

  2. On May 21, 3:45 am, "Jorgen Bodde" <> wrote:
    > 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
    Mike Driscoll, May 21, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mitchua
    Replies:
    1
    Views:
    7,049
    Ice Demon
    Jul 15, 2003
  2. Sam
    Replies:
    1
    Views:
    645
    seigo
    Nov 10, 2006
  3. keto
    Replies:
    0
    Views:
    908
  4. David Cournapeau

    print a vs print '%s' % a vs print '%f' a

    David Cournapeau, Dec 30, 2008, in forum: Python
    Replies:
    0
    Views:
    337
    David Cournapeau
    Dec 30, 2008
  5. Replies:
    15
    Views:
    467
    Terry Reedy
    Sep 10, 2012
Loading...

Share This Page