We want our system to automatically generate and send large amount of documents without human intervention.
However, determining where page breaks should be is quite a headache.
Our reports consist of report modules called “building blocks”. Currently, we try to anticipate where page breaks should be by starting large building blocks off with a page break. Although this works in preventing tables from starting near the end of a page, we still have the problem of unpredictable white space. Also, when a large building block follows another building block that just happens to end on the very last line of the previous page, the line break causes a blank page to be inserted in the document.
To overcome this problem, I’m contemplating the following solution: Each building block will contain a method telling the report engine the minimum amount of space (in points) it needs before generating, and how much space it used afterwards. The Engine will keep track of how many points is used, and how many points is available on the page. Based on this information, the engine can then make informed decisions on when to create the page breaks. The problem with this solution is that every building block will have to calculate how much space it is using. This is particularly problematic in tables, as it would be very difficult to predict when text will jump to the next line. Apart from the fact that this solution will create massive overhead in that I’d have to try and calculate the height of every single element in the building block, it will also suffer from not being 100% accurate. The solution is nice in theory, but I suspect it would be a maintenance nightmare in practice.
I’m hoping whether you guys would know of a better solution - one that might already be build into ASPOSE, or one that would work well with ASPOSE. I am aware of KeepTogether and KeepWithNext, but these functions are very limited and does not always work (For instance, you can’t keep an image of a graph with a table)
Your help is greatly appreciated.