We help IT Professionals succeed at work.

# Help with page break logic.

on
573 Views
I'm trying to find a good way of performing a mathematical calculation based on given quantities and logic, but my brain isn't working today so I was hoping someone might have done something similar and could provide some insight.

Here's what I'm trying to do.

I have "sections" of data.  It's XML.  I'm essentially wanting to force a page break before the data gets cut off by the PDF control in my web application.  I've determined some number for "maximum data to be on the page" - let's call that 100.

So what I'm looking at right now is about 20 "sections" and performing some sort of logic like this:

Section A
Section B
Section C
Section D

If
Section A + Section B > 100
Then
Page break before Section B.

If
Section A + Section B < 100
But
Section A + Section B + Section C > 100
Then
Page break before Section C.

If
Section A + Section B + Section C < 100
But
Section A + Section B + Section C + Section D > 100
Then
Page break before Section D.

Please let me know if you can think of another way to do this that would be less......verbose.

Thanks.
Comment
Watch Question
Commented:
This problem has been solved!
###### Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

Deciding to stick with EE.

Mohamed Asif

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant