printing HTML from Swing app in Windows ...

Discussion in 'Java' started by Giovanni Azua, Sep 28, 2004.

  1. Hello all,

    I have a Swing application that dynamically
    generates HTML documents, I need to let the
    user print the document but because of the
    little support of HTML flavor I could not have
    the Print Service API working for me.

    Another important remark is that this app is
    currently only used in Windows. Is there a way
    to have the explorer directly print the html
    document I have tried something like e.g.

    Runtime.getRuntime().exec("explorer -print " + url.toString());

    using the Windows Shell but does not work
    i.e. explorer does not print directly a file.

    Thanks in advance,
    Best Regards,
    Giovanni
    Giovanni Azua, Sep 28, 2004
    #1
    1. Advertising

  2. Giovanni Azua

    Tim Jowers Guest

    "Giovanni Azua" <> wrote in message news:<>...
    > Hello all,
    >
    > I have a Swing application that dynamically
    > generates HTML documents, I need to let the
    > user print the document but because of the
    > little support of HTML flavor I could not have
    > the Print Service API working for me.
    >
    > Another important remark is that this app is
    > currently only used in Windows. Is there a way
    > to have the explorer directly print the html
    > document I have tried something like e.g.
    >
    > Runtime.getRuntime().exec("explorer -print " + url.toString());
    >


    Giovanni,
    post to an IE group. I think the Windows Scripting Host (WSH) will
    probably be what you are looking for to cause IE to print. Or maybe an
    old-school Windows app that sendMessage. One other lazy way will be to
    put a JavaScript in each HTML file. onload it can call to print.

    Best luck,
    Tim

    > using the Windows Shell but does not work
    > i.e. explorer does not print directly a file.
    >
    > Thanks in advance,
    > Best Regards,
    > Giovanni
    Tim Jowers, Sep 29, 2004
    #2
    1. Advertising

  3. On Tue, 28 Sep 2004 19:17:30 +0200, Giovanni Azua wrote:
    >Hello all,
    >
    >I have a Swing application that dynamically
    >generates HTML documents, I need to let the
    >user print the document but because of the
    >little support of HTML flavor I could not have
    >the Print Service API working for me.
    >


    Hello,

    Using JEditorPane, you render and then print HTML documents.

    I've used the DocumentRenderer class to print:
    http://www.ftponline.com/javapro/codepage.asp?loccode=jpep021210kg

    (I implemented my own printable jeditorpane first, but this one was
    slightly better, like multiple page.

    --
    Gerbrand van Dieijen
    Gerbrand van Dieijen, Sep 29, 2004
    #3
    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. Big Daddy

    Java 1.2 Swing vs. Java 1.5 Swing

    Big Daddy, Apr 15, 2005, in forum: Java
    Replies:
    2
    Views:
    495
    Pete Barrett
    Apr 16, 2005
  2. mkrause
    Replies:
    0
    Views:
    669
    mkrause
    May 6, 2005
  3. John
    Replies:
    2
    Views:
    719
    Thomas Weidenfeller
    May 19, 2005
  4. lizard
    Replies:
    0
    Views:
    1,761
    lizard
    Jan 30, 2006
  5. S.T
    Replies:
    2
    Views:
    576
Loading...

Share This Page