469,628 Members | 1,205 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

print a page

rom
I need to print a html table when the user clicks on a
key. the problem is that i don't want the printer dialog
box to appear. i guess this is impossible in javascript so
i think to create an event that will be fired by a keyup
event, this event will submit the page, and i will be able
to print in from the vb.net without the printing dialog
box. the problem is that on the server i can't print the
web table because i already submitted that page.....well,
what i'm saying here is that i need help because i don't
know where to begin...i only know 1 thing - i need to
print the table after the user hits a key and the
operation must be very quick.

Thanks.
Nov 19 '05 #1
4 2158
You cant print without that dialogue - its a security thing. How would you
like to visit spam.com and suddleny have a million pages printing at your
printer without you requesting them - which is in effect what you are trying
to do.

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"rom" <me****@ifat.com> wrote in message
news:07****************************@phx.gbl...
I need to print a html table when the user clicks on a
key. the problem is that i don't want the printer dialog
box to appear. i guess this is impossible in javascript so
i think to create an event that will be fired by a keyup
event, this event will submit the page, and i will be able
to print in from the vb.net without the printing dialog
box. the problem is that on the server i can't print the
web table because i already submitted that page.....well,
what i'm saying here is that i need help because i don't
know where to begin...i only know 1 thing - i need to
print the table after the user hits a key and the
operation must be very quick.

Thanks.

Nov 19 '05 #2
Yes, I knew this is the limitation of Javascript.

However, from the MCP website, in the page to print the transcript, there is
an ActiveX button to print the transcript automatically without prompting
the print dialog box, do you have any idea on how do they achieve this?

Regards
Weichung

"John Timney (ASP.NET MVP)" <ti*****@despammed.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
You cant print without that dialogue - its a security thing. How would
you
like to visit spam.com and suddleny have a million pages printing at your
printer without you requesting them - which is in effect what you are
trying
to do.

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"rom" <me****@ifat.com> wrote in message
news:07****************************@phx.gbl...
I need to print a html table when the user clicks on a
key. the problem is that i don't want the printer dialog
box to appear. i guess this is impossible in javascript so
i think to create an event that will be fired by a keyup
event, this event will submit the page, and i will be able
to print in from the vb.net without the printing dialog
box. the problem is that on the server i can't print the
web table because i already submitted that page.....well,
what i'm saying here is that i need help because i don't
know where to begin...i only know 1 thing - i need to
print the table after the user hits a key and the
operation must be very quick.

Thanks.


Nov 19 '05 #3
I'm running into the same issue. We're using IE in kiosk mode with a touch
screen interface on a dedicated machine for an internal application.
Bypassing this dialouge is necessary to keep the "users" out of the print
settings ect... :-)

If it were my choice, and it's not, I would not use the browser as the
interface at all. However, since the browser interface is so popular, I
should still be able to do whatever I want even if it is stupid and insecure.

There must be a way to do this. The print button on the toolbar still
bypasses the dialogue....hmmm

Anyway, if I figure it out, I'll post it here.

"weichung[MCSD,MCDBA]" wrote:
Yes, I knew this is the limitation of Javascript.

However, from the MCP website, in the page to print the transcript, there is
an ActiveX button to print the transcript automatically without prompting
the print dialog box, do you have any idea on how do they achieve this?

Regards
Weichung

"John Timney (ASP.NET MVP)" <ti*****@despammed.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
You cant print without that dialogue - its a security thing. How would
you
like to visit spam.com and suddleny have a million pages printing at your
printer without you requesting them - which is in effect what you are
trying
to do.

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"rom" <me****@ifat.com> wrote in message
news:07****************************@phx.gbl...
I need to print a html table when the user clicks on a
key. the problem is that i don't want the printer dialog
box to appear. i guess this is impossible in javascript so
i think to create an event that will be fired by a keyup
event, this event will submit the page, and i will be able
to print in from the vb.net without the printing dialog
box. the problem is that on the server i can't print the
web table because i already submitted that page.....well,
what i'm saying here is that i need help because i don't
know where to begin...i only know 1 thing - i need to
print the table after the user hits a key and the
operation must be very quick.

Thanks.



Nov 19 '05 #4
Using IE resource kit you can disable the buttons for print and stop the
user changing setting etc which would solve your specific problem I expect.

There is a cludge that works in IE only - the code is shown below. You
might want to add a bit of div code around the print button that hides it
when the script executes so its not printed. Personally I would avoid this
type of thing but if it does the job then problem solved.

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director
<html>

<head>

<SCRIPT LANGUAGE="javascript">

// VALUES: intOLEcmd has these possible values
// OLECMDID_OPEN = 1
// OLECMDID_NEW = 2 warning, this kills IE
windows!
// OLECMDID_SAVE = 3
// OLECMDID_SAVEAS = 4
// OLECMDID_SAVECOPYAS = 5 note: does nothing in IE
// OLECMDID_PRINT = 6 note: give '-1' as param -
no prompt!
// OLECMDID_PRINTPREVIEW = 7
// OLECMDID_PAGESETUP = 8
function ieExecWB( intOLEcmd, intOLEparam )
{

// Create OLE Object
var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0
CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';

// Place Object on page
document.body.insertAdjacentHTML('beforeEnd', WebBrowser);

// if intOLEparam is not defined, set it
if ( ( ! intOLEparam ) || ( intOLEparam < -1 ) || ( intOLEparam > 1 ) )
intOLEparam = 1;

// Execute Object
WebBrowser1.ExecWB( intOLEcmd, intOLEparam );

// Destroy Object
WebBrowser1.outerHTML = "";
}

</script>

</head>
<body>

<button onClick="ieExecWB(6, -1)">
Print Me! - No Prompt!
</button>

Some text and other stuff to print
</body>
</html>



"John Wall" <John Wa**@discussions.microsoft.com> wrote in message
news:EC**********************************@microsof t.com...
I'm running into the same issue. We're using IE in kiosk mode with a touch
screen interface on a dedicated machine for an internal application.
Bypassing this dialouge is necessary to keep the "users" out of the print
settings ect... :-)

If it were my choice, and it's not, I would not use the browser as the
interface at all. However, since the browser interface is so popular, I
should still be able to do whatever I want even if it is stupid and insecure.
There must be a way to do this. The print button on the toolbar still
bypasses the dialogue....hmmm

Anyway, if I figure it out, I'll post it here.

"weichung[MCSD,MCDBA]" wrote:
Yes, I knew this is the limitation of Javascript.

However, from the MCP website, in the page to print the transcript, there is an ActiveX button to print the transcript automatically without prompting the print dialog box, do you have any idea on how do they achieve this?

Regards
Weichung

"John Timney (ASP.NET MVP)" <ti*****@despammed.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
You cant print without that dialogue - its a security thing. How would you
like to visit spam.com and suddleny have a million pages printing at your printer without you requesting them - which is in effect what you are
trying
to do.

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"rom" <me****@ifat.com> wrote in message
news:07****************************@phx.gbl...
> I need to print a html table when the user clicks on a
> key. the problem is that i don't want the printer dialog
> box to appear. i guess this is impossible in javascript so
> i think to create an event that will be fired by a keyup
> event, this event will submit the page, and i will be able
> to print in from the vb.net without the printing dialog
> box. the problem is that on the server i can't print the
> web table because i already submitted that page.....well,
> what i'm saying here is that i need help because i don't
> know where to begin...i only know 1 thing - i need to
> print the table after the user hits a key and the
> operation must be very quick.
>
> Thanks.


Nov 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

21 posts views Thread by Steel | last post: by
3 posts views Thread by Umut Tezduyar | last post: by
reply views Thread by Paco Ferre | last post: by
reply views Thread by ShaneO | last post: by
4 posts views Thread by CSharpguy | last post: by
6 posts views Thread by CSharpguy | last post: by
2 posts views Thread by bob | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.