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

Free Support Forum - aspose.com

Update page numbers automatically in PDF after page insert using C# | Aspose.PDF


I’m using Aspose.PDF for .Net (v. 21.1.0) and I’m hoping you can advise me on the following:

My input file (input.pdf, attached) has 2 pages. Please note that it contains page numbers (top center) and date fields (bottom left; “4/19”).

I’m inserting a blank page using the following code:
var document = new Document(“D:/input.pdf”);

My resulting document (output.pdf, attached) has 3 pages, but I also need to update the page numbers and the date fields. Could you please advise on how it can be done?

If this is not available directly, could you please give me more details on the following:
I noticed that the values I need to change are stored in Artifacts for each page. So I suppose I could use them to edit them? However, I can’t see any difference (except the text, obviously) between the artifacts for a page number and a date field. Is there any way to distinguish these? Please note that “2/12” could be both a page number (2 of 12) and a date.


input.pdf (576.3 KB)
output.pdf (574.7 KB)


We would like to share with you that there is not header/footer type of entity which can be dealt separately in PDF document format. In other words, they can only be defined or specified at the time of PDF generation. Once the PDF has been generated, they become part of other content on the page and can be identified as separate header/footer entity(s). Which concludes that automatic updating of page numbers or footer date section cannot be achieved using the API.

However, you can perform find and replace text operation over PDF in order to find the specified text and replace it with your desired value. In case you need further information, please feel free to let us know.

This feature seems to be available in Adobe Acrobat Pro. Could you please give me more details on whether the limitation is in the pdf format or the Aspose library?
Since there seems to be some way to do it (Adobe), would it be possible to add it to Aspose PDF if we raise it as paid support?
If so, what would be the expected timelines?


We have logged an investigation ticket as PDFNET-49833 in our issue tracking system to further analyze your requirements in details. We will first investigate the feasibility of it and let you know if this feature can be added or not and how soon it can be added if escalated to the paid support. Please be patient and spare us little time.

Thank you for looking into this.
To be more specific about our requirements - we may also need to copy an existing page (document.Pages.Add(document.Pages[2])) instead of just adding a blank one.
So currently we would get pages numbered 1, 2, 2 and we’d like them to be 1, 2, 3.


We have updated the ticket information according to the information you just provided. We will surely investigate the requirements and share our feedback with you.


Would you please provide more details about how you are able to achieve automatic page number update in Adobe Reader? Using page thumbnails tab we are able to change numbering format in Adobe Reader. Please share the steps on how you are doing this at your end. We will further investigate your requirements accordingly.

Please note that we’re using Adobe Acrobat Pro for this, not Acrobat Reader.

To add page numbers we do the following:

  1. Click ‘EditPdf’.
  2. Click ‘Header & Footer’ and choose ‘Add’.
  3. In the desired position apply ‘Insert Page Number’.
  4. Confirm the changes.

To update the numbers after a page has been added:

  1. Click ‘EditPdf’.
  2. Click ‘Header & Footer’ and choose ‘Update’.
  3. Without any changes, confirm.

Same procedure applies to the date fields.

After a closer look it seems more like re-applying than updating. Still, Adobe is able to recognise headers / footers and replace the expected values.
We don’t necessarily require a fully automatic update of those fields but we need a clear way to locate and access them (regardless of the exact format used on creation), similar to what Acrobat Pro does.


We have updated the information against the earlier logged ticket and will inform you as soon as we have additional updates regarding its resolution.

Hi @asad.ali

Could you please give me any update on this?



We are afraid that the earlier logged ticket is not yet investigated. Please note that it will be analyzed and resolved on a first come first serve basis. We will surely inform you as soon as the ticket is investigated and we have some updates regarding its resolution. Please be patient and spare us some time.

We are sorry for the inconvenience.