Skip to content

Commit 278e6f3

Browse files
authored
Merge pull request #186 from nidzoletina/mod/expose-current-migra-doc-position
Mod/expose current MigraDoc position
2 parents c826420 + 707f100 commit 278e6f3

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

MigraDocCore.Rendering/MigraDoc.Rendering/FormattedDocument.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,19 @@ public PageInfo GetPageInfo(int page)
423423
return this.pageInfos[page];
424424
}
425425

426+
427+
/// <summary>
428+
/// Returns the absolute Y position of the last item on the last page in points.
429+
/// Must be called after rendering the document.
430+
/// </summary>
431+
/// <returns>The current Y position at the end of the last page.</returns>
432+
public double GetCurrentMigraDocPosition()
433+
{
434+
RenderInfo[] RenderInfos = GetRenderInfos(PageCount);
435+
RenderInfo r = RenderInfos[RenderInfos.Length - 1];
436+
return r.LayoutInfo.ContentArea.Y + r.LayoutInfo.ContentArea.Height;
437+
}
438+
426439
#region IAreaProvider Members
427440

428441
Area IAreaProvider.GetNextArea()

0 commit comments

Comments
 (0)