Capture PrintDialog Events

Discussion in 'Javascript' started by aimee, Sep 16, 2003.

  1. aimee

    aimee Guest

    Hi. Is there a way to capture the events fired in a PrintDialog? I
    would like to capture when the user presses "Print" so I can do some
    cleanup.
    The asp.net (IE6) application I'm working on has 6 pages, each of
    which has a link to a "print view" page. That "print view" page has a
    "print" button which calls a javascript function "printThis":


    function printThis() {
    alert('printThis')
    window.print();
    /*window.onafterprint fires when page
    is loaded into print dialog, not
    when page is actually printed;
    need to capture when user actually hits
    the 'print' button on the printDialog
    and call donePrinting
    */
    }

    function donePrinting() {
    alert('donePrinting')
    document.all.hdnFldPrinted.value = true;
    document.forms[0].submit();
    /*code for clean-up and redirection
    to one of 6 pages is in code-behind */
    }


    Does anyone know how I can capture when the user presses the "print"
    button in the PrintDialog that's opened by window.print()?
    Thanks in advance.

    Aimee Ukasick
    SBC
    aimee, Sep 16, 2003
    #1
    1. Advertising

  2. aimee

    Brett Merkey Guest

    "aimee" <> wrote in message
    news:...
    | Hi. Is there a way to capture the events fired in a PrintDialog? I
    | would like to capture when the user presses "Print" so I can do some
    | cleanup.
    | The asp.net (IE6) application I'm working on has 6 pages


    The easiest course of action is to use the onbeforeprint and
    onafterprint events to call your functions.

    Brett
    Brett Merkey, Sep 17, 2003
    #2
    1. Advertising

  3. aimee

    aimee Guest

    "Brett Merkey" <> wrote in message news:<nTN9b.59865$>...
    > "aimee" <> wrote in message
    > news:...
    > | Hi. Is there a way to capture the events fired in a PrintDialog? I
    > | would like to capture when the user presses "Print" so I can do some
    > | cleanup.
    > | The asp.net (IE6) application I'm working on has 6 pages
    >
    >
    > The easiest course of action is to use the onbeforeprint and
    > onafterprint events to call your functions.
    >
    > Brett


    That is what I tried first. The 'onafterprint' fires *before* the
    print dialog appears, and is thus not a viable option for this
    particular scenario.
    After more poking around, I discovered that the 'onbeforeprint' and
    'onafterprint' events are attached neither to the Print dialog box nor
    the printing.
    http://support.microsoft.com/defaul...port/kb/articles/Q272/7/65.ASP&NoWebContent=1

    So I will have to redesign how the section of the app that handles
    printing.

    aimee
    aimee, Sep 17, 2003
    #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. Charles A. Lackman

    PrintDialog

    Charles A. Lackman, Jun 4, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    887
    Ron Allen
    Jun 5, 2004
  2. Peter McMahon [MVP]

    Re: How can I run the PrintDialog()

    Peter McMahon [MVP], Jul 1, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    372
    Peter McMahon [MVP]
    Jul 1, 2003
  3. Mike John
    Replies:
    0
    Views:
    351
    Mike John
    Jul 2, 2003
  4. =?ISO-8859-1?Q?J=F6rg_Marti?=

    JPS 1.4: unit of measurement in the printDialog()

    =?ISO-8859-1?Q?J=F6rg_Marti?=, Aug 12, 2003, in forum: Java
    Replies:
    0
    Views:
    347
    =?ISO-8859-1?Q?J=F6rg_Marti?=
    Aug 12, 2003
  5. terry
    Replies:
    0
    Views:
    930
    terry
    Sep 11, 2003
Loading...

Share This Page