Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Print Page Break - HTML Page Break

Posted on 2004-10-25
8
Medium Priority
?
53,996 Views
Last Modified: 2011-08-18
Is there a way to put a character within HTML so when someone prints the HTML form/screen I can force a page break. I want to develop a new HTML form/screen for an employee to fill out, and when they print it the screen/form prints two separate pages. I want to be able to control where the 2nd page starts.
0
Comment
Question by:tomhoran
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 14

Accepted Solution

by:
RichieHindle earned 500 total points
ID: 12404563
You need to use the CSS "page-break-before" or "page-break-after" properties.  Here's a working example:

<html>
<head>
<style type='text/css'>
@media print
{
    .pagestart
    {
        page-break-before: always;
    }
}
</style>
</head>
<body>
<p>This is on page 1.</p>
<p class='pagestart'>This is on page 2.</p>
</body>
</html>
0
 

Author Comment

by:tomhoran
ID: 12404637
That's eay .. will that work in both IE and netscape .. anothers all browsers ?
0
 
LVL 14

Expert Comment

by:RichieHindle
ID: 12404808
I tested it in IE6 and Firefox 1.0PR on XP.  I don't have older versions to try it with, but I'd be very surprised if it didn't work in IE5+ and Netscape 6+.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 3

Expert Comment

by:nan1217
ID: 12405260
I had a hard time getting those CSS properties to work and ended up using a PDF component to have ultimate control.  ABCPDF (abcpdf.com) can be used free if you link back to their site.  If you pay for a component, I like ASPPDF (asppdf.com).
0
 
LVL 14

Expert Comment

by:RichieHindle
ID: 12405339
nan1217: Can you elaborate on 'a hard time'? Did you find that older browsers didn't support them, or were buggy, or that the properties didn't work with your content...?
0
 
LVL 3

Expert Comment

by:nan1217
ID: 12405354
The properties didn't work for me.

Here's an example of someone else using these properties in a PAQ.  http://www.experts-exchange.com/Web/Web_Languages/CSS/Q_21118256.html
0
 

Expert Comment

by:Gary_Eisert
ID: 12577331
What I do is pick a tag where you want the page to break. In this example I used the  H3 tag

In the header add this line

<STYLE>H3 { PAGE-BREAK-BEFORE: always }</STYLE>

Wherever the <H3> is in the body of your page it will produce a page break.

In order to test it, use IE 5+ and try the Print Preview. You should be able to see if it works on screen.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question