Has anyone displayed a web page to open automatically in print preview? I would like to know how it is done. I can't find an example and I don't want to rely on "right clicking" the page to select "print preview". When the webpage is selected, I would
like it displayed in "Print Preview".
Has anyone displayed a web page to open in print preview? I would like to know how it is done. I can't find an example and I don't want to rely on "right clicking" the page to select "print preview". When the webpage is selected, I would like it displayed
in "Print Preview".
If you want something like that then it is simple you just need to edit your CSS and make everything 100% so it fits every screen and will be suitable for printing. Its just plain CSS which formats the page for printing.
Ray Accomand...
0 Points
3 Posts
Displaying Web Page as Print Preview
Dec 09, 2012 05:38 PM|LINK
Has anyone displayed a web page to open automatically in print preview? I would like to know how it is done. I can't find an example and I don't want to rely on "right clicking" the page to select "print preview". When the webpage is selected, I would like it displayed in "Print Preview".
CriticalErro...
Member
448 Points
408 Posts
Re: Displaying Web Page as Print Preview
Dec 09, 2012 06:15 PM|LINK
Like I have done?
http://library.thecodingguys.net/reference/csharp/cs46765
Click the print icon top right.
If you want something like that then it is simple you just need to edit your CSS and make everything 100% so it fits every screen and will be suitable for printing. Its just plain CSS which formats the page for printing.
My Site | My Blog
Ray Accomand...
0 Points
3 Posts
Re: Displaying Web Page as Print Preview
Dec 09, 2012 10:13 PM|LINK
No. I want the print preview to display the cshtml file when the file is selected. Having a print button is the same as "right clicking" the web page.
Resumepod
Member
58 Points
106 Posts
Re: Displaying Web Page as Print Preview
Dec 12, 2012 09:23 PM|LINK
You can do this with events in javascript.
e.g. on your body tag you can add an onload method that executes the window.print()
e.g.
Resumepod
Member
58 Points
106 Posts
Re: Displaying Web Page as Print Preview
Dec 12, 2012 09:25 PM|LINK
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Page.ClientScript.RegisterStartupScript(this.GetType(), "Print", "javascript:window.print();", true); } }