The EnsureDocumentMeasuredAndArranged() method calls recursively the Measure() and Arrange() methods to all document children respectively. The Measure() method is measuring the DocumentLayoutBox using RadDocument.MAX_DOCUMENT_SIZE and the Arrange() method is arranging the DocumentLayoutBox using new RectangleF(PointF.Empty, this.document.DesiredSize). Check the following code snippet:
this.document.Arrange(new RectangleF(PointF.Empty, this.document.DesiredSize));
You can download and take look at our source code if you want to get more in detail on a specific part of the code.
I tried to change the LayoutMode to Paged or Flow and the result was the same. I am attaching a sample project demonstrating what I am testing. Please, feel free to modify it in a way closer to your scenario.
As for the calculation of the remaining height of a Page, you can use the Modulus operator ("%") in order to get the remainder of the division. The margins are included when you use the BoundingRectangle.Botton and you don't need to take care of them. Check the following code snippet:
double lastParagraphBoundingRectangleBottom = lastParagraph.LastLayoutBox.BoundingRectangle.Bottom % (double)section.PageSize.Height;
As for the values on the Y-axis, in order to investigate it, I need more information on how exactly this behavior is achieved or a sample project demonstrating it.
Please, let me know if there is anything else I can assist you with.
Progress is here for your business, like always. Read more
about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.