Hi There,
Thanks for contacting support.
When I merge the two, I end up with two page stamps. In other words, page 11 has two stamps overlapping each other (I attached a screen shot):
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px 'Helvetica Neue'; -webkit-text-stroke: #000000}
span.s1 {font-kerning: none}
I will appreciate if you please share your sample code along with input files. It will help us to understand your requirement exactly and address it accordingly.
Is there a way to remove pagenumberstamps prior to merging?
Yes, you can remove pageNumberStamps prior to merging. Please check below sample code snippets for removing the pageNumberStamps from the PDF document.
C#
Aspose.Pdf.Facades.PdfContentEditor contentEditor = new Aspose.Pdf.Facades.PdfContentEditor();
contentEditor.BindPdf(dataDir + "AddPageNumbers.pdf");
//Get all stamps in the document
Aspose.Pdf.Facades.StampInfo[] stampInfo = contentEditor.GetStamps(1);
contentEditor.DeleteStampByIds(new int[] { 999 });
//save file
contentEditor.Save(dataDir + "testout.pdf");
After removing Stamps from both PDF documents you can merge and create a new Stamp with the help of following code snippet.
C#
// Create PdfFileStamp object
PdfFileStamp fileStamp = new PdfFileStamp();
// Open Document
fileStamp.BindPdf(dataDir + "concatenatedfile.pdf");
// Get total number of pages
int totalPages = new PdfFileInfo(dataDir + "concatenatedfile.pdf").NumberOfPages;
// Create formatted text for page number
FormattedText formattedText = new FormattedText("Page # Of " + totalPages, System.Drawing.Color.Blue, System.Drawing.Color.Gray, Aspose.Pdf.Facades.FontStyle.Courier, EncodingType.Winansi, false, 14);
// Please note you must add StampId, so you can remove it by StampId
fileStamp.StampId = 999;
// Set starting number for first page; you might want to start from 2 or more
fileStamp.StartingNumber = 1;
// Add page number
fileStamp.AddPageNumber(formattedText, 0);
// Save updated PDF file
fileStamp.Save(dataDir + "AddPageNumber_out12.pdf");
// Close fileStamp
fileStamp.Close();
If you still face any issue, please feel free to contact us.
Best Regards,