Can i know how many pages have been printed

Hi,
I wanna to show “CurrentPageCount of TotalPagesCount” in the footer.
Is there any way to get the total page count.

Hi
Thanks for your request. You can insert PAGE and NUMPAGES field to achieve this. See the following code.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToHeaderFooter(HeaderFooterType.FooterPrimary);
builder.Write("Page ");
builder.InsertField("PAGE", "");
builder.Write(" of ");
builder.InsertField("NUMPAGES", "");
builder.MoveToDocumentStart();
builder.InsertBreak(BreakType.PageBreak);
builder.InsertBreak(BreakType.PageBreak);
builder.InsertBreak(BreakType.PageBreak);
builder.InsertBreak(BreakType.PageBreak);
builder.InsertBreak(BreakType.PageBreak);
doc.Save(@"261_98347_jonathanh\out.doc");

But you can’t get the total page count. See FAQ for more information.

Best regards.