We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

AddPageNumber method not being placed right

I am trying to place my page number at a specific location but it is not doing what its supposed to be doing. here is my code snippet:

        //Header that goes on each page
        headerText = "Received:" +
                DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString() + " Page # of " + numPages;

        // Create formatted text for page number
        FormattedText pageNumFormattedText = new FormattedText(headerText, new FontColor((byte)0, (byte)0, (byte)0),
            FontStyle.TimesRoman, EncodingType.Winansi, false, 9.0f);

        pdfFileStamper = new PdfFileStamp(memStreamOriginal, memStreamOutput);

        pdfFileStamper.AddPageNumber(pageNumFormattedText, pdfFileStamper.PageWidth + 40 , pdfFileStamper.PageHeight - 18);

@karl.scales,

Can you please share source file along with desired result and generated result as well to further investigate this issue. Also please share complete working sample code so that we may help you out.

I’m not sure what you mean by source file. The snippet that i gave you is a sample code and it works just doesn’t place the page number in the desired location. I’m using AddPageNumber(FormattedText, X float, Y Float). If i change the Y property it moves up and down but if i use the x float it doesn’t move left or right it just stays in the center of the page.

@karl.scales,

I like to inform that I need source mean sample PDF file which you are using along with desired result PDF in form of sample so that I may work out to help you.