Self Print HTML page.

  • Thread starter Thread starter Sunil Thomas
  • Start date Start date
S

Sunil Thomas

Hi,
I have developed an ASP.Net application to assist our Field Engineers
compile online site survey's for on site assets. The application is
functional except for a major setback which is the prinitng of all the
workorders at the end of the day. The supervisor has a page which displays
the WO's for the day (roughly 30-40) in a datagrid, each of which has to be
individually clicked to launch an HTML report page, which he then has to
print...
:-(
Is there any way in which the launched page can print itself to the default
printer.
I can then have the page launched, printed and closed, which can then be
modified to a Datagrid with checkboxes etc... the only glitch is the self
printing pages!!!
Help!!!

Sunil Thomas.
 
Hi Sunil,
Is there any way in which the launched page can print itself to the default
printer.

I think this is on the client side. VB.net works on the serverside.
So you have a better change to get an answer in the asp.net newsgroup or in
a javascript newsgroup. (But maybe you get your answer her).

But I can help you a littlebit. If you got the javascript, you can start
that from the serverside in VB.net, that is with something like
\\\
Dim str As String
str = "<script language=javascript> {window.open('http://www.google.com');}
</script>"
RegisterStartupScript("Startup", str)
///
I hope this helps a little bit?

Cor
 
Hi Cor,
Maybe I should have been a bit more specific.

Yes, your analysis of my problem is extremely accurate and that is exactly
the solution for which I was hunting.

Below is the code implemnting the client side of things.

<body onload="DoPagePrint()" bottomMargin="4" leftMargin="5" topMargin="4"
rightMargin="0" MS_POSITIONING="GridLayout">

<script language=javascript>
function DoPagePrint()
{
self.print();
}
</script>

This does what I want to some extent, however, I want to do away with the
print dialog box and print directly to the printer.

Any ideas????

Thanks for the help so far.....

Regards,
Sunil
 
Hi Sunil,

If I was you, I should not look for it.

This is on MSDN.

Printing from script is supported in Internet Explorer 5 and later by
calling Window.Print. However, this always displays the Print dialog box,
which can't be suppressed. Printing is considered a security issue; a Web
page should not have the ability to start a print job without confirmation
from the user.

You have a change that when you have found it, the next Microsoft security
patch kills your solution.

Cor
 
Hi Cor,

I can't believe this is the end of my project, due to such a technicality...
Thanks a lot for your help.
Though I am too far in to give up now... maybe something like a trusted
process, activeX something.... must be able to achieve it....
You have been kind to this disheartened soul...
Happy coding.
 
Hi Sunil,
When you don't give up, you can turn the project around.
Make a window application, which get the information from your website.
Then you don't have that trouble I think
Cor
 
Back
Top