We help IT Professionals succeed at work.

Hard Code a page break??

dmatthews
dmatthews asked
on
Medium Priority
223 Views
Last Modified: 2013-12-24
I have a report which contains many cfincludes of different pages. I want a page break after each different section. I currently am using a div layer with a .footer heading like this .footer {
font-weight : "bold";
page-break-after : "always";.

Then i include a footer in each page in a footer.cfm page with the <div class=footer> around it.

When i print it on my computer it works fine. I'm using IE 5.5. Other people's computers it doesnt print right. Can anybody tell me why it isnt working this way OR if anybody knows another way it would be great!!!!!

Comment
Watch Question

Commented:
Try this!

this .footer {
font-weight : bold;
page-break-after : always;
page-break-before:always;
}
I have also tried this.. it doesn't seem to work...   one question..  what is with the "this" before the .footer??  What does the "this" do???

Commented:
try putting this wherever you want the pagebreaks:
<p style="page-break-before: always">

Author

Commented:
where do you suggest i put the <p style="page-break-before> tag. This is the way it iw set up. I'll call the first page page1.cfm. It looks like this
<html>
<body>
<CFINCLUDE template="pageA.cfm">

<CFINCLUDE template="pageB.cfm">

<CFINCLUDE template="pageC.cfm">

<CFINCLUDE template="pageD.cfm">

<CFINCLUDE template="pageE.cfm">
</body>
</html>

In each of the pages, A,B,C,D, E i have this at the bottom
<CFINCLUDE template="footer.cfm">

Footer.cfm looks like this

<CFOUTPUT>
<DIV class="footer">
<center><font size="-2"><b>
Stuff i want in the footer goes here. </b></font></center>
<center><font size="-2"><b>Page #PageNumber#</b></font></center>
<CFSET TopPage = PageNumber + 1>
<A name="Page#TopPage#"></A>
</DIV>
</CFOUTPUT>

Then of course i have the style sheet which looks like this.

<style media=print type="text/css">
.header {
   font-family : "Times New Roman", Times, serif;
    font-size : "16pt";
    font-weight : "bold";
    text-align : "left";
}
.page {
  font-family : "Times New Roman", Times, serif;
    font-size : "10pt";
    font-weight : "";
}

.footer {
font-weight : bold;
font-style : italic;
page-break-after : always;
page-break-before : always;
}
</style>

So where do you suggest i put the <p> tag??


Commented:
in footer.cfm  if that is where you want the page to break (each time it is called)

Author

Commented:
where do you suggest i put the <p style="page-break-before> tag. This is the way it iw set up. I'll call the first page page1.cfm. It looks like this
<html>
<body>
<CFINCLUDE template="pageA.cfm">

<CFINCLUDE template="pageB.cfm">

<CFINCLUDE template="pageC.cfm">

<CFINCLUDE template="pageD.cfm">

<CFINCLUDE template="pageE.cfm">
</body>
</html>

In each of the pages, A,B,C,D, E i have this at the bottom
<CFINCLUDE template="footer.cfm">

Footer.cfm looks like this

<CFOUTPUT>
<DIV class="footer">
<center><font size="-2"><b>
Stuff i want in the footer goes here. </b></font></center>
<center><font size="-2"><b>Page #PageNumber#</b></font></center>
<CFSET TopPage = PageNumber + 1>
<A name="Page#TopPage#"></A>
</DIV>
</CFOUTPUT>

Then of course i have the style sheet which looks like this.

<style media=print type="text/css">
.header {
   font-family : "Times New Roman", Times, serif;
    font-size : "16pt";
    font-weight : "bold";
    text-align : "left";
}
.page {
  font-family : "Times New Roman", Times, serif;
    font-size : "10pt";
    font-weight : "";
}

.footer {
font-weight : bold;
font-style : italic;
page-break-after : always;
page-break-before : always;
}
</style>

So where do you suggest i put the <p> tag??


Commented:
put the P tag wherever you want the break to be.

If you want a page break after your footer.cfm put it inside footer.cfm (at the end)

Also.. to reload/refresh a question here at EE click on the link provided on the top right.. when you hit reload it re-posts your last comment.

CJ

Author

Commented:
Footer.cfm now looks like this and it still doesnt work.

<p style="page-break-before: always">
<CFOUTPUT>
<DIV class="footer">
<center><font size="-2"><b>
(#Session.FooterDate#)&nbsp;______COMPUTER ASSOCIATES INTERNATIONAL, INC. CONFIDENTIAL______&nbsp;(Site ID: #Session.SiteID#)</b></font></center>
<center><font size="-2"><b>Page #PageNumber#</b></font></center>
<CFSET TopPage = PageNumber + 1>
<A name="Page#TopPage#"></A>
</DIV>

</CFOUTPUT>
</p>

Author

Commented:
Do you mean like this in footer.cfm

<CFOUTPUT>
<DIV class="footer">
<center><font size="-2"><b>
(#Session.FooterDate#)&nbsp;______COMPUTER ASSOCIATES INTERNATIONAL, INC. CONFIDENTIAL______&nbsp;(Site
ID: #Session.SiteID#)</b></font></center>
<center><font size="-2"><b>Page #PageNumber#</b></font></center>
<CFSET TopPage = PageNumber + 1>
<A name="Page#TopPage#"></A>
</DIV></CFOUTPUT>
<p style="page-break-before: always">


</p>

Commented:
Yup. the last one.. It should work in IE.

CJ

Author

Commented:
I assume that i would have to take out the <DIV Class="footer"> tag.

Commented:
yes.

Author

Commented:
right now footer.cfm looks like this

<CFOUTPUT>
<!--<DIV class="footer">--->
<center><font size="-2"><b>
(#Session.FooterDate#)&nbsp;______COMPUTER ASSOCIATES INTERNATIONAL, INC. CONFIDENTIAL______&nbsp;(Site ID: #Session.SiteID#)</b></font></center>
<center><font size="-2"><b>Page #PageNumber#</b></font></center>
<CFSET TopPage = PageNumber + 1>
<A name="Page#TopPage#"></A>
<!---</DIV>--->
</CFOUTPUT>
<p style="page-break-after: always">
</p>

I get a page break using this but the guy  next to me who runs IE 5.0 gets no page break at all. So basically i am back to where i started. It runs on mine but not everyones.

Commented:
some more info:
http://www.blooberry.com/indexdot/css/properties/print/pbafter.htm

This property seemingly is supported by IE 4+

as is shown here:
http://support.microsoft.com/directory/article.asp?ID=KB;EN-US;q180856

Good info here:
http://www.richinstyle.com/guides/paged2.html#pagebreaks

This discussion indicates that the problem is not isolated:
http://www.tek-tips.com/gviewthread.cfm/lev2/4/lev3/32/pid/215/qid/71583

This link shows that there are bugs in IE 5:
http://www.richinstyle.com/bugs/ie5demo.html search for "page break"
It seems to suggest bugs when using multiple page breaks and the fact that they have "left" and "right" attributes.

For a full reference check out:
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/properties/pageBreakAfter.asp

also try removing the space btw. "page-break-after: always" to "page-break-after:always"

"always" is supposedly the property that IE 4,5+ support

This discussion might shed some light on the subject:
http://www.alistapart.com/discuss/read.cfm?forum=80&id=6528&thread=1618

CJ

Author

Commented:
  I have it working now in both. Did you notice that i changed your <p style="page-break-before: always"> to <p style="page-break-after: always"> because assumed that is where the page break should be, after the footer. Well i put it back to what you said and commented out the div stuff and it is working now.

THANKS!!!!!!!

Commented:
Glad I could help :-)

Explore More ContentExplore courses, solutions, and other research materials related to this topic.