You can use the PageNumber Stamp class to add a page number stamp in a PDF file. PageNumber Stamp class provides properties necessary to create a page number based stamp like format, margins, alignments, starting number, etc. All details you can see here.