ststeiger / PdfSharpCore

Port of the PdfSharp library to .NET Core - largely removed GDI+ (only missing GetFontData - which can be replaced with freetype2)
Other
1.06k stars 235 forks source link

MigraDocCore - paragraph.AddNumPagesField does not reset if page number is reset #319

Open virajkanwade opened 1 year ago

virajkanwade commented 1 year ago

Say on the 3rd page, I do the following:

    Section section = document.AddSection();
    section.PageSetup = document.DefaultPageSetup.Clone();
    section.PageSetup.OddAndEvenPagesHeaderFooter = true;
    section.PageSetup.StartingNumber = 1;

    Paragraph paragraph = new Paragraph();
    paragraph.AddText("Page ");
    paragraph.AddPageField();
    paragraph.AddText(" of ");
    paragraph.AddNumPagesField();

It prints "Page 1 of 3" instead of the expected "Page 1 of 1".

How do I make this work?