DocumentPageCount Property
Gets the number of pages in the document as calculated by the most recent page layout operation.

Namespace: Aspose.Words
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.9
Syntax
public int PageCount { get; }

Property Value

Type: Int32
Remarks
Examples
Shows how to invoke page layout and retrieve the number of pages in the document.
[C#]

Document doc = new Document(MyDir + "Document.doc");

// This invokes page layout which builds the document in memory so note that with large documents this
// property can take time. After invoking this property, any rendering operation e.g rendering to PDF or image
// will be instantaneous.
int pageCount = doc.PageCount;
See Also