'How to put total page numbers in content page using iText

I have a class that create a pdf file using iText. My document has a text that needs appear in the content area of the first page, something like that "This document has 10 pages". All examples i found to do that, like this put page number when create PDF with iTextSharp show the pages number in header or footer, not in content area. Any idea how to do that?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source