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

Free Support Forum - aspose.com

Page number of resultant Pdf document is not updated

Hello Everyone,

While adding two or more pdf document into one, I am not getting the updated page number of resultant pdf document. Is there any way to delete the page number? Or any other way to update the page number?

I am doing this to add two pdf document:

Note: There is a way in this link for Adding and Removing page numbers using aspose.words.

Best Regards.

Hi there,

Thanks for your inquiry. You may add page number stamp with id in Pdf documents and later can delete stamp using that id as following. It will help you to remove the page number stamp from concatenated PDF document and later you can add a new page number stamp for concatenated PDF document. Hopefully it will help you to accomplish the task.

//*Adding stamp with ID//

//Open document

Document pdfDocument = new Document(myDir + “PageNumber.pdf”);

//Create page number stamp

PageNumberStamp pageNumberStamp = new PageNumberStamp();

//Whether the stamp is background


pageNumberStamp.setFormat("Page # of
" +




//Set text properties







//Add stamp to particular page


//Save output document

pdfDocument.save(myDir + “output_imageStamp.pdf”);

//Removing Stamp with id//

PdfContentEditor contentEditor = new PdfContentEditor();

contentEditor.bindPdf(myDir + “output_imageStamp.pdf”);

StampInfo[] stampInfo =


//Loop through each stamp

for (int i = 0; i <
stampInfo.length; i++)

//Check to see if the ID = 111, if so delete the stamp.<o:p></o:p>

(stampInfo[i].getStampId() == 111)
 contentEditor.deleteStampById(stampInfo[i].getStampId()); }<o:p></o:p>
contentEditor.save(myDir + "output_deletedstamp.pdf");

Best Regards,

Hello Tilal Ahmad,

Thanks for your answer. But this is not what I am looking for, I am searching for deleting those page numbers, which already exists and don’t get ordered while adding two or more pdf into one. Hope you get me now.

With your suggested method, page numbers can be deleted only if they are created by PageNumberStamp.


Hi there,

Thanks for your feedback. I am afraid there is no direct option available to remove header/footer contents added by other applications, as different applications use different logic to add header/footer. However you may try to search and replace text to remove text in PDF page footer.

Best Regards,

Hello Tilal,

My pre-existing page # was due to workbooks.

Here is the scenario: I was converting workbooks into pdf Document and then adding them into one, due to which I was getting page number from those workbook.

Solution: I disable the footer from the each sheet of the excel file, which I was using as workbook. And then I use PageNumberStamp to add the page numbers.


Hi there,

Thanks for your feedback. It is good to know that you have manged to resolve the issue at your own.

Please keep using Aspose.Pdf and feel free to contact us for any query or concern, we will be more than happy to extend our support.

Best Regards,