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

Free Support Forum - aspose.com

PDFFileStamp performance issue for adding Header-Footer and PageNumbers


I am using PDFFileStamp for adding header, footer and page numbers. My pdf file is 5000 pages big and is of 500 MB size. I am adding different page footer on every page and by doing so the final document generation takes 5 minutes. If I remove the code for footer it will get generated in 50 seconds. here is a small code snippet how I am using the PDFFileStamp.

PdfFileStamp pfe = new PdfFileStamp(pdfDocument);
pfe.addHeader(new FormattedText(“Header”), 10);

for(int i=1; i<pdfDocument.getPages().size; i++)
pfe.addFooter(new FormattedText(“Footer for page " + i), 10)
pfe.addPageNumber(new FormattedText(” Page #"));

If in the above code I comment the footer code the file gets generated with no performance issue and it takes 50 seconds to generate. Can you please let me know if I am doing something wrong.

Rajeev Mathur

Hi Rajeev,

Thanks for your inquiry. Aspose.Pdf Processing time depends upon the contents and size of the resultant files along with your system resources. However we have logged an investigation ticket PDFNEWJAVA-34398 in our issue tracking system for further investigation and will share your findings as soon as possible.

We are sorry for the inconvenience caused.

Best Regards,