473,396 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 2331
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Steel | last post by:
Hi at all, I have a very long html page with many photo. Therefore the best to print this page is to print the some page as PDF. Therefore I maked a PDF file like my page to print best. I'ld want...
3
by: Umut Tezduyar | last post by:
In the msdn.microsoft.com/library most of the articles have an "print" option. But the "print" button is different from the javascripts "window.print()" method. It postpacks the page and then...
0
by: Paco Ferre | last post by:
Hello, I founded some examples of WebControl printing in internet and tryed to have them working for a DataGrid, something not very complicated. I have a page, Page1.aspx with a DataGrid...
16
by: Neal | last post by:
Hi, I saw the VB6 Code to do this at this link: http://www.dotnet247.com/247reference/msgs/11/56581.aspx The VB6 Code reads as follows: Private Type Rect Left As Long
1
by: hamil | last post by:
I am trying to print a graphic file (tif) and also use the PrintPreview control, the PageSetup control, and the Print dialog control. The code attached is a concatination of two examples taken out...
22
by: stephen | last post by:
I have created an order form that users javascript to create a new html document when the customers clicks the "print page" button. Once the new document has been created it then prints the...
0
by: ShaneO | last post by:
There have been similar questions raised in the past, however no answers seem to have been provided, so I thought I'd give it a go. Scenario 1: My Windows Forms app generates (say) 10 pages in a...
4
by: CSharpguy | last post by:
My web app is using master pages, On the content page I'm using a GridView. I need to print my GridView and I need to exclude the HyperLink columns. How can I print my content page and exclude the...
6
by: CSharpguy | last post by:
In my gridview I have 2 -3 template fields which are hyperlinks. I allow the user to print this grid. When the grid prints it also prints the links, how can I take the user to a print preview page...
2
by: bob | last post by:
Hi, I have a page that has a collection of things which it passes to a second 'print' page using a session variable. The print page has buttons for moving though the collection and the user ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.