Printing in an applet

Discussion in 'Java' started by KenH, Aug 16, 2005.

  1. KenH

    KenH Guest

    I have a charting applet that has a print method that works just fine.

    My problem is I am trying to initiate the print method from a
    javascript routine but it doesn't work.

    I access my applet from javascript all the time (feeding data hidden in
    a form to the chart), but for some reason trying to launch the printing
    from javascript doesn't work. Any ideas? Do I have to set some kind of
    focus?
     
    KenH, Aug 16, 2005
    #1
    1. Advertising

  2. On 16 Aug 2005 10:35:41 -0700, KenH wrote:

    > I have a charting applet ..


    URL?

    > ..but for some reason trying to launch the printing
    > from javascript doesn't work.


    It may be Bad Mojo. Or alternately there is a slight chance
    there are exceptions or errors listed in the Java or JavaScript
    consoles of your browser. But since you did not mention any,
    I'm guessing Bad Mojo.

    > Any ideas?


    Security? <http://www.physci.org/codes/javafaq.jsp#security>

    [ Read the entire FAQ - lots on applets. ]

    --
    Andrew Thompson
    physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
    "At least you won't have time to be bored.." Midnight Oil 'Power & The
    Passion'
     
    Andrew Thompson, Aug 16, 2005
    #2
    1. Advertising

  3. KenH

    KenH Guest

    The applet runs on my company intranet. I check the console when I run
    it...no errors in java, and nothing in javascript. I'll look over the
    FAQ just the same.
     
    KenH, Aug 16, 2005
    #3
  4. On 16 Aug 2005 10:54:27 -0700, KenH wrote:

    > The applet runs on my company intranet.


    You can move it to a free site where we can see
    it break, or prepare a simple example that
    demonstrates the same behaviour and do the same.

    It's up to you.

    >..I check the console when I run
    > it...no errors in java,


    Do you swallow exceptions? [1]

    >..and nothing in javascript. I'll look over the
    > FAQ just the same.


    I recommend that. [1] (FAQ mentions swallowing exceptions)

    --
    Andrew Thompson
    physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
    "Sing out Hare Hare, dance the Hoochie Koo." Led Zeppelin 'The Song
    Remains The Same'
     
    Andrew Thompson, Aug 16, 2005
    #4
  5. KenH

    Roedy Green Guest

    On 16 Aug 2005 10:35:41 -0700, "KenH" <> wrote or
    quoted :

    >I have a charting applet that has a print method that works just fine.


    It should not work just fine UNLESS it is signed. Is the problem you
    are testing it running it as an application on in Eclipse Appletviewer
    where you don't need signing, and now you are running it truly as an
    Applet for the first time when you use JavaScript?
     
    Roedy Green, Aug 16, 2005
    #5
  6. Roedy Green wrote:
    > On 16 Aug 2005 10:35:41 -0700, "KenH" <> wrote or
    >
    >
    >>I have a charting applet that has a print method that works just fine.

    >
    > It should not work just fine UNLESS it is signed. Is the problem you
    > are testing it running it as an application on in Eclipse Appletviewer
    > where you don't need signing, and now you are running it truly as an
    > Applet for the first time when you use JavaScript?


    Not true. Way back in 1998 JRE 1.2 changed the behaviour to pop up a
    little window to confirm the print. Just like JNLP, only completely
    different.

    It gave me a surprise. I found out by testing printing in the applet I
    was working on didn't work under the Plug-In. Actually it didn't work.
    It deadlocked instead.

    I suggest KenH checks to see whether the code execution gets as far as
    the print request, and whether it gets any further. Not tried mixing
    Java and JavaScript. The only other thing I can think of is the effect
    of having the JavaScript handling code with whatever class loader on the
    stack while attempting to print.

    Tom Hawtin
    --
    Unemployed English Java programmer
    http://jroller.com/page/tackline/
     
    Thomas Hawtin, Aug 16, 2005
    #6
  7. KenH

    Roedy Green Guest

    On Tue, 16 Aug 2005 21:10:43 +0100, Thomas Hawtin
    <> wrote or quoted :

    >Not true. Way back in 1998 JRE 1.2 changed the behaviour to pop up a
    >little window to confirm the print. Just like JNLP, only completely
    >different.


    Nowhere does Sun tell you which system properties require signing and
    which are safe. I scoured the docs and code to no avail. I compiled a
    list by experiment at http://mindprod.com/jgloss/properties.html I
    should not have had to do that.

    I had to find out by experiment that you can read some files off the
    home website but not others in an unsigned Applet.

    Now I find out, again indirectly by fluke experiment, that the
    printing restriction is gone.
     
    Roedy Green, Aug 17, 2005
    #7
    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. Rob Love

    applet vs. canvas in applet

    Rob Love, Jul 7, 2003, in forum: Java
    Replies:
    1
    Views:
    622
    Liu, Chunyen
    Jul 7, 2003
  2. webster
    Replies:
    0
    Views:
    860
    webster
    Jul 20, 2003
  3. Andrew Thompson
    Replies:
    0
    Views:
    416
    Andrew Thompson
    Aug 5, 2003
  4. Blah Blah
    Replies:
    0
    Views:
    1,435
    Blah Blah
    Aug 13, 2003
  5. Jade
    Replies:
    3
    Views:
    933
    Roedy Green
    Aug 14, 2003
Loading...

Share This Page