CSS force Pagebreak

We need a page break option as used in MS word, is this possible?

Page breaks can be forced by CSS, see: http://www.w3.org/TR/CSS21/page.html and http://davidwalsh.name/css-page-breaks.

We've uploaded a test file to our server for testing:

http://pdfmyurl.com/test/test_pagebreak.html

For things to work the following option should be set: --print-media-type, used for print media-type instead of screen.

The following url demonstrates the working of this:

http://pdfmyurl.com/?url=http://pdfmyurl.com/test/test_pagebreak.html&--print-media-type

Comments

I have tried for at least 3 days, of stripping my HTML pages down to the bare minimum - no CSS rules were affecting the layout - I tried tables and using divs - has anyone else had success with this?

Hi Garry,

have you taken a look at the source of the example:
http://pdfmyurl.com/test/test_pagebreak.html

@media print
{
table {page-break-after:always}
}

should do the trick

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.