PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Current Page Number?
https://forum.pdfsharp.net/viewtopic.php?f=2&t=1918
Page 1 of 1

Author:  Cory Dee [ Wed Feb 22, 2012 9:51 pm ]
Post subject:  Current Page Number?

I'm using MigraDoc to create a document.

I have some paragraphs that I don't want to span pages.

My intent is do something like:

Code:
int startPage = sec.LastParagraph.PageNumber();
sec.AddParagraph("text goes here");
if (startPage < sec.LastParagraph.PageNumber()) {
    sec.LastParagraph.Format.PageBreakBefore();
}


How can I find out what the current page is?

Author:  Thomas Hoevel [ Thu Feb 23, 2012 9:15 am ]
Post subject:  Re: Current Page Number?

The current page is determined when the document is being rendered.

Simply set KeepTogether = true (instead of PageBreakBefore) for paragraphs that must not span pages.

Author:  Cory Dee [ Thu Feb 23, 2012 3:35 pm ]
Post subject:  Re: Current Page Number?

Awesome, thanks!

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/