Purpose
This function returns the total number of pages in the book. Normally it is used as an expression in a span of the Master page to show the total number of pages.
Syntax
int TotalNumberOfPages = 0 // Number of pages in the book
//
TotalNumberOfPages := Book.NumberofPages()
//
TotalNumberOfPages := Book.NumberofPages()
Arguments
This function has no arguments.Return value
Returns the total number of pages in the book, known at the time when the function is called. If the value of the NumberofPagesConfirmed function is True, the value returned by NumberOfPages is correct. If instead the value of the NumberofPagesConfirmed function is False, the function returns the value known by the system at the time the function was called.
- If you use the NumberofPages function in the expression of a span to indicate, for example, the total number of pages in the book, you need to select the PrecountPages flag, visible in the book properties form. This is necessary because the function returns the number of pages known at the time of the call, and when the system prepares the print of page 1, the call to the function returns 0 because the system has not yet finished processing the current page or the subsequent pages. With the PrecountPages flag set, the system prints the book twice: the second time (the definitive print) the total number of pages is known, and the call to the NumberofPages function returns the correct value, given that the system saves the total number of pages after the first round.
- If the PrecountPages flag is enabled and the book is printed, the NumberofPagesConfirmed function returns the value False during the first print round and the value False during the second print round.
- The PrecountPages flag, visible in the book properties form, does not have to be set if you only need to know the number of pages printed after printing the book, and therefore if the function is called after the Print procedure. In fact, when printing is complete the system knows the total number of pages and the number returned by the function is the correct one anyway.
Changed on: 23/03/2021 / From version: 6.5.2680