Capture PrintDialog Events

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • aimee

    Capture PrintDialog Events

    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('printThi s')
    window.print();
    /*window.onafter print 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('donePrin ting')
    document.all.hd nFldPrinted.val ue = 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
  • Brett Merkey

    #2
    Re: Capture PrintDialog Events

    "aimee" <bmkealu@yahoo. com> wrote in message
    news:6a0b0f8.03 09161044.17608e 9d@posting.goog le.com...
    | 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


    Comment

    • aimee

      #3
      Re: Capture PrintDialog Events

      "Brett Merkey" <bmerkey@tampab ay.rr.com> wrote in message news:<nTN9b.598 65$875.2539081@ twister.tampaba y.rr.com>...[color=blue]
      > "aimee" <bmkealu@yahoo. com> wrote in message
      > news:6a0b0f8.03 09161044.17608e 9d@posting.goog le.com...
      > | 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[/color]

      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.


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

      aimee

      Comment

      Working...