-3

Possible Duplicate:
css print styling

How to change programmatically the settings of Print -> Page Setup, either server or client side, in an asp.net mvc application?

I need to change Layout, Margins and “Print background Colors and images”, before printing the content of the page.

Thanks.

Community
  • 1
  • 1
Stefan Fachmann
  • 555
  • 1
  • 5
  • 18
  • Problem here is you really can not control it. Some browsers are now letting you do it with CSS as the dupe I just listed shows. If you really need control, people usually convert their pages to pdf to print. – epascarello Dec 27 '12 at 14:19
  • Yikes IE! Good luck. You can go with an ActiveX solution. – epascarello Dec 27 '12 at 19:39
  • [What have you tried?](http://www.whathaveyoutried.com) – JDB Dec 28 '12 at 02:24
  • @Cyborgx37 everything I could find in internet including the solution specified in Possible Duplicate:[css print styling](http://stackoverflow.com/questions/7086342/css-print-styling). Should I now enumerate all the solutions I tried? – Stefan Fachmann Dec 28 '12 at 17:05
  • @StefanFachmann - We are all taking time out of our day to help you at no charge. The snarkiness is unwarranted. The comment above is a hyperlink to an article. – JDB Dec 28 '12 at 17:28
  • @Cyborgx37 sure. That is why the thread was closed. – Stefan Fachmann Jan 02 '13 at 07:57

1 Answers1

0

Have you tried specifying a special .css for printing purposes only?

<link rel="stylesheet" href="URL to your print.css" type="text/css" media="print" />

And rewrite the .css in this print.css so it looks decent when you print it.

Other sources:
W3Schools
onextrapixel

Syneryx
  • 1,278
  • 11
  • 18
  • The issue is not to print, or not, certain html elements. The issue is to, at least print it in landscape layout. – Stefan Fachmann Dec 27 '12 at 16:33
  • @StefanFachmann - you never mentioned landscape in your question and "layout" can mean many different things. CSS styles are about as close as you can get to controlling page margins. – JDB Dec 28 '12 at 02:23
  • @Cyborgx37 Really? What else can mean "layout" in context of printing? In google chrome with CSS you can control the layout too. – Stefan Fachmann Dec 28 '12 at 08:12
  • @StefanFachmann - You may have an information box floated to the right which, when printing, you want placed at the top of the page with the remaining document flowing underneath it. This would be a change in the layout of your page when printing it. – JDB Dec 28 '12 at 14:01
  • @Cyborgx37 sure, I may, or I may not. – Stefan Fachmann Dec 28 '12 at 17:00
  • @StefanFachmann - thus the ambiguity. – JDB Dec 28 '12 at 17:30