p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   CSS Cascading Style Sheets (http://p2p.wrox.com/forumdisplay.php?f=146)
-   -   Overwrite user page setup for printing (http://p2p.wrox.com/showthread.php?t=27447)

peter2004 March 29th, 2005 09:30 PM

Overwrite user page setup for printing
 
Hi,
I would like to set the top, bottom, left, and right margin for my form print out. Therefore, it is not dependent on user page setup option for his/her internet explorer. Is there a CSS method to do this?

Thanks in advance,
Peter

Peter

joefawcett March 30th, 2005 06:00 AM

You can have two css specifications, one for screen and one for print, like this:
Code:

@media screen {
   BODY {margin: 1cm;}
}

@media print {
   BODY {margin: 3cm;}
}


--

Joe (Microsoft MVP - XML)

peter2004 March 30th, 2005 08:29 PM

Joe, thanks for the reply. Your suggestion did not totally resolve my problem because the margin amount is added to the default internet explorer page setup margin. For example, my page setup set all the margins to .75inch for portrait paper; thus, following your suggestion, the first line printed out is 3cm + .75 inch. What I really want is to overwrite the .75inch margin.

Peter

Peter

joefawcett March 31st, 2005 06:32 AM

If you mean the settings in the print setup then you cannot change those without an ActiveX control. I have often used ScriptX from meadroid.com. It has a free subset that lets you cahnge a lot of settings but obviously this will only work if the user has IE and allows ActiveX. Otherwise you're stuck with advising them to open the settings box and changing it manually.

--

Joe (Microsoft MVP - XML)

richard.york March 31st, 2005 09:24 AM

You should be able to do that with the @page rule. Been a while since I experimented with it, but from what I remember IE supports this.

http://msdn.microsoft.com/workshop/a...rties/page.asp
http://www.w3.org/TR/CSS21/page.html#page-box

Regards,
Rich

--
[http://www.smilingsouls.net]
Mail_IMAP: A PHP/C-Client/PEAR solution for webmail
Author: Beginning CSS: Cascading Style Sheets For Web Design

peter2004 March 31st, 2005 02:53 PM

Thanks for the reply. I attempted to use the @page rule before but I didn't have any success with it. I will have to educate myself more on this method. If all esle fail, I will attempt the ActiveX control.

Thanks,
peter

Peter

joefawcett March 31st, 2005 05:04 PM

I've never had any joy from the @page rule. Even using print templates I had to parse the rule manually.

--

Joe (Microsoft MVP - XML)

Choong April 5th, 2007 10:52 AM

Hi, this is the same problem i am currently facing where i need to overwrite the default top margin setup in IE. This issue was posted in 2005 and now in 2007, i hope someone has a solution for this issue.

peter2004,
It would be of greatest help to me, if you may guide me on this.

Thank you very much.

Regards,
Choong


janez December 17th, 2007 05:51 PM

hi, peter and Choong, did you find a solution for this issue? I am search for a workaround for a while but had no luck. I really hope there is a way to overwrite the default margins without trying active x. Thanks.



All times are GMT -4. The time now is 10:05 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.