Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is there a way besides using iTextSharp to print a web form without the control buttons and URL at the top and bottom of the page? This is my print code so far.

C#
protected void ButtonPrint_Click(object sender, EventArgs e)
    {
      ButtonPrint.Attributes.Add("onclick", "window.print(); return false");
    }
Posted
Comments
Richard C Bishop 4-Dec-13 11:53am    
Why use "return false"?
Computer Wiz99 4-Dec-13 11:56am    
You know what? I really don't know but it still works. Is there a way to remove the URL from the top and bottom of the page and the control buttons?
Richard C Bishop 4-Dec-13 12:00pm    
Fair enough. Window.print() prints the entire window. What about trying what this article does:

http://stackoverflow.com/questions/12997123/print-specific-part-of-webpage
Wombaticus 7-Dec-13 9:00am    
To not print certain controls on a form add a style sheet with its media property set to "print" - eg
<style type="text/css" src="path_to_css_file" media="print" />
and in that set
display:none;
for any elements you don't want to print.

As do the URL at the bottom, that is a prnter setting on the client side, and there s nothing you can do about that.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900