View Full Version : How to implement "page-break-inside:avoid" functionality in reports?

11-30-2006, 11:13 PM

I have a problem with page breaks in our PDF reports, that are created on the fly from HTML stream (using a PDF generator) - the PDF created this way is then used by various (very important!) users for printing and arhiving.

As I mentioned there are issues with page breakes - as usually breaks are "inserted" at the end of the page, which is not OK, because there are some parts of the HTML content that must not appear on 2 pages (eg. tables).

Does anybody know of any solution that would put a page break before specific content in case there is not enough room for that content on the page? Unfortunatelly page-break-inside:avoid command (CSS2) is not supported in IE6/7 or Firefox. Probably, we'll need to calculate the remaining space on the page before each DIV and compare it to the space required by a specific DIV, but don't know how to do it exactly. Is there a method in .NET that we could use for this?

Thanks so much for your help.

12-01-2006, 07:38 PM
When I worked with generated PDFs, I had to build functionality to add an element to a temp page, see how big the element was, determine if it could fit or start a new page.

Sounds like you need to not use a stream or look at the documentation of the pdf api (if you are using one)


12-02-2006, 01:58 PM
Thanks. We have also been thinking about solutions with TEMP pages, but it quite hard to make everything work properly - especially, because we don't have any experience in that field.

Today I have also learned from the authors of PDF generator we use, that the new version supports page-break-inside CSS style - we have tested it and it works great.


EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum