Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > CSS > CSS Cascading Style Sheets
| Search | Today's Posts | Mark Forums Read
CSS Cascading Style Sheets All issues relating to Cascading Style Sheets (CSS).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the CSS Cascading Style Sheets section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old March 29th, 2005, 09:30 PM
Authorized User
 
Join Date: Apr 2004
Location: , , .
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
__________________
Peter
  #2 (permalink)  
Old March 30th, 2005, 06:00 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

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)
  #3 (permalink)  
Old March 30th, 2005, 08:29 PM
Authorized User
 
Join Date: Apr 2004
Location: , , .
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
  #4 (permalink)  
Old March 31st, 2005, 06:32 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

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)
  #5 (permalink)  
Old March 31st, 2005, 09:24 AM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

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
  #6 (permalink)  
Old March 31st, 2005, 02:53 PM
Authorized User
 
Join Date: Apr 2004
Location: , , .
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
  #7 (permalink)  
Old March 31st, 2005, 05:04 PM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

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)
  #8 (permalink)  
Old April 5th, 2007, 10:52 AM
Registered User
 
Join Date: Apr 2007
Location: KL, , Malaysia.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

  #9 (permalink)  
Old December 17th, 2007, 05:51 PM
Registered User
 
Join Date: Dec 2007
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.



Similar Threads
Thread Thread Starter Forum Replies Last Post
Print a page without changing page setup nrajeshatwork Servlets 1 May 23rd, 2007 10:09 AM
User Setup, Help needed! alien13 C# 2005 2 April 10th, 2007 06:15 AM
Printing - Set Page SETUP misskaos99 Classic ASP Basics 1 February 20th, 2007 03:39 PM
Printing PDF (page x to y) / multiple page seq's robbert XSLT 1 November 13th, 2006 10:27 AM
How to pass data to user interface (.NET Setup) saeedahmed C# 2 November 10th, 2005 06:48 AM





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