navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

Page Break Script

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> General Web Development >> Page Break Script
Page: [1]
 
BeamMeUp

 

Posts: 12
From: None
Status: offline

 
Page Break Script - 6/13/2002 10:55:17   
Does anyone know if it is possible to have a script automatically create page breaks in a long html document that contains tables and photos, so that when printing one page or the entire document, the photos and/or a line of text is not split in two.

I know how to manually insert the page-break tag but this will need to generate correct printing pages based on what is selected, or the entire document.

Mojo

 

Posts: 2429
From: Chicago
Status: offline

 
RE: Page Break Script - 6/13/2002 11:11:36   
The following code will force a pagebreak in CSS2:

<P style="page-break-after: always">

You may want to look into this attribute because there is more to it...





(in reply to BeamMeUp)
rdouglass

 

Posts: 9167
From: Biddeford, ME USA
Status: offline

 
RE: Page Break Script - 6/13/2002 13:45:09   
Yes it is possible. I do it on a form results for a census form that gets emailed. Each page holds 13 clients. The relevant portion of the page I use looks something like:

'-------------------- Build pages recursively
FOR pageNumber = 1 to totalPages

'-------------------- Display user info on each page
strText = strText & "<p CLASS='page' align='center> </p>" & vbcrlf & "<p align='right'><font face='Arial' size='2'>Page # " & pageNumber & "</font></p>" & vbcrlf
strText = strText & "<p align='center'><font face='Arial' size='4'>Group Census<br>Confidential List of All Eligible Employees</font></p>" & vbcrlf
strText = strText & userInfoTable & "<br>"

'-------------------- Begin employee info table
strText = strText & "<div align='left'><table border='1' cellpadding='2' cellspacing='0' width='895' columns='10'>" & vbcrlf

'-------------------- Display table header
strText = strText & tableHeader

'-------------------- Build table of employees by retrieving array items
FOR e = 0 to 12
f = (((pageNumber - 1) * 13) + e)
IF f <= upper THEN
strText = strText & arrEmployees(f)
ELSE
END IF
NEXT
strText = strText & "</table></div>" & vbcrlf

'-------------------- Next page
NEXT


and I had a line like this in my <style> section:

p.page { page-break-before: always }

(I just break before instead of after for personal preference ) The full code of the page can be seen here:

http://www.clarkinsurance.com/cdonts_example.htm

but the whole page is primarily a CDONTS script to send HTML mail. It gets a little involved using arrays and such, but the code showing the recursive use of the page break is above.

Any help???

 

(in reply to BeamMeUp)
ahaynes106

 

Posts: 7
Joined: 8/1/2005
Status: offline

 
RE: Page Break Script - 8/10/2005 18:48:59   
quote:

<P style="page-break-after: always">


do you need anything else? I stuck that in my code where I wanted the page break to oocur, but nothing. It just printed past that point until the page filled up and overflowed to the next page.

(in reply to rdouglass)
ahaynes106

 

Posts: 7
Joined: 8/1/2005
Status: offline

 
RE: Page Break Script - 8/19/2005 13:15:35   
I found these on MozillaZine Forums. Finally, something that worked for me on Firefox and IE. Not sure why the others worked in IE but not Mozilla.

This works:
<p>
...
</p>
<br style="page-break-before: always;" clear="all" />

This works:
<div>
...
</div>
<p><br style="page-break-before: always;" clear="all" /></p>

And this works:
<div>
...
</div>
<br style="page-break-after: always;" clear="all" />

(in reply to ahaynes106)
jaybee

 

Posts: 13972
Joined: 10/7/2003
From: Berkshire, UK
Status: offline

 
RE: Page Break Script - 5/8/2008 7:14:14   
All sounds just Hunky Dory doesn't it. You stick in this little bit of code and Hey Presto! Problem solved.

Unfortunately, you haven't taken into account that different people have different printers with different gutters, margins, paper sizes and so on and so forth.

If you want to force page breaks you need to test on a load of different printers or your cleverly formatted instructions will be churning out half filled pages for some people.

_____________________________

If it ain't broke..... fix it until it is.
:)

:)
GAWDS
Now where did I put that Doctype?

(in reply to ahaynes106)
jaybee

 

Posts: 13972
Joined: 10/7/2003
From: Berkshire, UK
Status: offline

 
RE: Page Break Script - 5/8/2008 7:17:01   
quote:

ORIGINAL: ahaynes106

quote:

<P style="page-break-after: always">


do you need anything else? I stuck that in my code where I wanted the page break to oocur, but nothing. It just printed past that point until the page filled up and overflowed to the next page.


quote:

ORIGINAL: Mojo
You may want to look into this attribute because there is more to it...


It's CSS you need to read up on it.

_____________________________

If it ain't broke..... fix it until it is.
:)

:)
GAWDS
Now where did I put that Doctype?

(in reply to ahaynes106)
d a v e

 

Posts: 4013
Joined: 7/24/2002
From: England (but live in Finland now)
Status: offline

 
RE: Page Break Script - 5/8/2008 8:56:12   
you do have a print stylesheet don't you?!

_____________________________

David Prescott
Gekko web design

(in reply to jaybee)
rdouglass

 

Posts: 9167
From: Biddeford, ME USA
Status: offline

 
RE: Page Break Script - 5/8/2008 8:57:38   
...jaybee answering 3 year old posts? Must be an imposter.....:)

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to jaybee)
d a v e

 

Posts: 4013
Joined: 7/24/2002
From: England (but live in Finland now)
Status: offline

 
RE: Page Break Script - 5/8/2008 10:11:20   
dang - got me too! and the original post was in 2002!

_____________________________

David Prescott
Gekko web design

(in reply to rdouglass)
Page:   [1]

All Forums >> Web Development >> General Web Development >> Page Break Script
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts