NUMPAGES
Non-MailMerge field
{ NUMPAGES [ switch ] }
Inserts the total number of pages.
The NUMPAGES
field is layout-dependent. If this field is located outside the main document body (header/footer, endnote/footer, comment, or text box), use Layout API to get the field result. Obtain the PlainTextBox related to the field and call the DocumentLayout.GetText(LayoutElement) method (or use the PlainTextBox.Text property) to retrieve the field result.
Note
Do not nest the PAGE and NUMPAGES fields inside fields that are in headers or footers. Field values can be incorrect due to limitations of the current layout calculation. Refer to the following topic for information on how to create a nested field: How to: Create a Nested Field.