467,915 Members | 1,858 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,915 developers. It's quick & easy.

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('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
Jul 20 '05 #1
  • viewed: 5618
Share:
2 Replies
"aimee" <bm*****@yahoo.com> wrote in message
news:6a*************************@posting.google.co m...
| 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
Jul 20 '05 #2
"Brett Merkey" <bm*****@tampabay.rr.com> wrote in message news:<nT*********************@twister.tampabay.rr. com>...
"aimee" <bm*****@yahoo.com> wrote in message
news:6a*************************@posting.google.co m...
| 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/default...NoWebContent=1

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

aimee
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by ohaya | last post: by
4 posts views Thread by Steph. | last post: by
3 posts views Thread by Dave | last post: by
4 posts views Thread by mafandon | last post: by
2 posts views Thread by =?Utf-8?B?c25naWxi?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.