HTML -- Page Breaks and Printing

Does anyone know if there is an HTML tag that will force a page break?
Specifically, I have a large amount of text (about 10-12 pages)that I am printing out, formatted in HTML, and I would like to be able to have certain sections of the text start out on a new page.

I have tried using a <STYLE> tag:

and then using <DIV CLASS=“page”>, but this doesn’t seem to work.
Does anyone have any suggestions? I was hoping there might be some obscure HTML tag that would force a page break, but I would settle for ASP or javascript code as well.

Also, to get the page to print, I have set up a button, and in the onclick event, I have this:

onClick=“window.print(‘Orientation : portrait’)”

Is there a way to get the page to start printing, without having the browser bring up a seperate print dialog box?

I’m 99% sure there’s no way in plain HTML to force page breaks; it was never intended to have that ability. Good luck finding a Java alternative.

I have often wondered about this too. I would like to have the ability to do that but I think the problem is that HTML was always aimed at the monitor screen and not the printed page. I think PDF was devised with the idea that the screen and printed page look the same.

In HTML I can have different screen resolutions, type size etc. Also my printer page size and capabilities may not be the same as yours. If I force a page break where I want it to suit my needs, it could well be that the last line in my first page happens at the top of your second page and you then force a new page…

I have found myself having two versions of the same document. One HTML for web and one in MS-WORD for printing. Converting from one to the other always takes quite a bit of formatting and retouching so I doubt the possibility of forcing a new page in HTML would be too helpful.

Ultimately, I am sure that converting it to PDF format is the best way to go about this. I have found a dll that will convert HTML pages into PDF files, and when I can get someone to install it on the server here I will use that.

In trying to force a page break, I’m not particularly concerned with how it looks on the monitor, just in how it is sent out to the printer.

Microsoft’s MSDN site claims that you can do this by using a style sheet (see my first post in this thread), but I have not been able to get it to work so far.

For now, I will just put in a bunch of <BR> tags, though this isn’t really a solution because the page is built dynamically.

I realize that this is an old thread to be replying to, but I finally figured out how to do it. (Well, I hadn’t actually been making a determined effort to figure it out since November, but I did finally come across the solution)

Anyway, to force a page-break when you are printing out HTML, you need to create a seperate Cascading Style Sheet, rather than just writing it out in-line style like I tried before.
In the CSS, I wrote it out like this:


.pagebreak
{
    PAGE-BREAK-BEFORE: always
}

Then just set a DIV tag with the class = “pagebreak”, and when you print out from your browser, each DIV will be printed on a seperate page.

I’m sure everyone will be breathing a sigh of relief now.

Hehe, I was going make a post pointing the OP to this old thread, when I realized this was the old thread :slight_smile:

Thanks for the update, though- now I’ve achieved closure …

Arjuna34