Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > CSS for printing - forcing page break

CSS for printing - forcing page break
Thread Tools
Junior Member
Join Date: Jun 2003
Location: Bergen, Norway
Status: Offline
Reply With Quote
Jan 22, 2004, 08:05 AM
 
We're creating a system where we at the end of a registration process need to print two pages of information. This information will be "boxed" (hence - css framing), and will look like a form. However, the amount of information in one or two of the blocks will differ, and we need to make sure which blocks end up on which page, and make sure the print is never more than two sheets of A4 sized paper.

So:
1. Is it possible to use css to enforce box sizes and margins in millimetres instead of pixels?
2. Is it possible to force a page-break when printing?

The system will take the user through a series of registering the required information, and will at the end produce a page where the user is to go through and check for errors, after which he/she would press a "Print and Save" button. After this, the information presented on that page is to be printed onto the pages mentioned above. The layout could be the same, but the best would be to have a specific layout for the print version, and a more suitable layout for the screen presentation.
Hallvard Opheim
Dual 2GHz G5, 9800Pro, 2.5GB, BT, iSight
PB17 1GHz, 1GB
     
Clinically Insane
Join Date: Nov 1999
Status: Offline
Reply With Quote
Jan 22, 2004, 09:50 AM
 
1) Certainly you can use millimeters instead of pixels; just use mm instead of px. CSS actually supports a wide range of measurement units, and although not all of them are useful onscreen, print is another issue.

2) What you want are the page-break-before and/or page-break-after properties. However, I'm not sure how well-supported they are. The latest Safari supports them, and I think Gecko does as well, but I don't know about Opera or IE. On browsers which don't support them, they don't do anything.
You are in Soviet Russia. It is dark. Grue is likely to be eaten by YOU!
     
opheim  (op)
Junior Member
Join Date: Jun 2003
Location: Bergen, Norway
Status: Offline
Reply With Quote
Jan 22, 2004, 01:08 PM
 
Thanks. As far as my somewhat limited CSS-experience goes, I think you can set media-type in the css, in order to use separate style-sheets for printing and on-screen publishing of data. I'll sit down in the weekend and try to figure this out... Thanks so far!
Hallvard Opheim
Dual 2GHz G5, 9800Pro, 2.5GB, BT, iSight
PB17 1GHz, 1GB
     
Mac Elite
Join Date: Oct 2000
Status: Offline
Reply With Quote
Jan 22, 2004, 05:25 PM
 
Originally posted by Millennium:
2) What you want are the page-break-before and/or page-break-after properties. However, I'm not sure how well-supported they are. The latest Safari supports them, and I think Gecko does as well, but I don't know about Opera or IE. On browsers which don't support them, they don't do anything.
Just to add on WestCiv has a great resource on this here and a browser compatibility chart here.

Opera has support for everything apparently. NS7 based on Mozilla supports it so you have that. IE 5.5 and 6.0 on Windows supports page breaks and IE 5 for Mac does as well. All those with Safari gets you pretty well covered.

You're only problems would be users with IE 4/5.0 Win and older versions of Netscape which are still somewhat prominent especially with institutions. The good thing about CSS is that it won't adversely affect your page if it isn't supported, it will simply ignore it.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 12:52 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2