0

I generate a PDF with MigraDoc in C# with a table that may contain several rows (that can run over many pages). At the end of this document, I have to add an "ending part" with a table and some paragraphs. The problem is : this ending part musn't be cut/separated between two pages. This ending part has a height, and if I've enought height on my page, I put it there, otherwise, I must jump to a new page and add it there.

Unfortunately, I don't find a way to do that. My table's rows doesn't have fixed height so my table neither. How can I find the "spared space" ? I'm sure I'm not the only one with this problem. Do you have any tricks ?

Thank you in advance

1 Answers1

0

A simple solution is marking the ending part as "keep together".
If the ending part consists of paragraphs only, mark all paragraphs as "KeepTogether" and mark all but the last as "KeepWithNext".
Or maybe create a new table and put the ending part in a single row and it will be kept together on one page. You can place tables inside tables:
https://stackoverflow.com/a/36304148/162529

When using MigraDoc properly, you typically do not have to bother with heights.