Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help just printing a webpage

Status
Not open for further replies.

dashen

Programmer
Joined
Jul 14, 2005
Messages
233
Location
US
I have a webpage that I wasnt to set up to print on the click of a print button in ASP.NET 2.0

I am not sure how to call the print command for the webpage though. I am using VB.NET as the background language. I also want to set the properties to not print a header or footer. Any help will be greatly appreciated. :)
 
Is there a specific method call that can be done for this? Or do I have to write something to stream the page? That seems way too much hassle for .NET 2005.
 
Try the javascript method window.print(). Is this what you are lookking for?

Sunil
 
Is there any other method? The javascript:Windows.Print
doesn't allow header and footer hiding.

Also, I wanted to find out if there is a way in ASP.NET where there is a method call built by MS for printing. There has to be right? Or is ActiveX the only way?
 
I've ran across this a lot at work, since the header and footers are on the client's machine, the only way to 'hide' them is to gain access to controls on their machine, and the only way I've found so far is an ActiveX object just as you stated above.
 
Boo!!!... :( ;)

Any second opinions? I don't want to mess with ActiveX. I have in previous solutions, but since the platforms for the end-users are so different in a lot of cases I have run into a lot of issues with ActiveX in the past. I guess if I have to then I will have to. But this project is a really crucial solution for our department (we are talking large scale), and if anything messes up it is my head in the clincher.

If there are any .NET 2005 gurus that can give a more elegant solution, I would very much appreciate it.
 
Printing is a client side function and as ASP.NET is a server side language there isn't any ASP.NET solution you can use (apart from registering client side code from the server). So, you have only one option really - javascript's window.print function.

If you want to control what is printed when the user actually clicks print, you can simply use a CSS stylesheet and set the media property to "print". Teh browser will automatically use this stylesheet when it prints the contents.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Why not make them a pdf with itext for .net and let them print that?

Christiaan Baes
Belgium

"My new site" - Me
 
[Google]iText .NET[/Google]

Although I think it's overkill to have to go and create a PDF just to print a web page. Personally, I'd much prefer the CSS approach.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
The CSS style sheet approach still would not disable headers and footers tied to IE or the browser you use. It only adds to the header and footer right?
 
I don't know what you mean. A CSS stylesheet can control exactly what is sent to the printer.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top