By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,143 Members | 1,854 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,143 IT Pros & Developers. It's quick & easy.

Capture PrintDialog Events

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
"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

P: n/a
"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.