Performance issues overlaying text on existing PDF

I am in the process of evaluating Aspose.Pdf with an eye to replacing the usage of PdfSharp. We use PdfSharp to overlay text on existing PDF documents, with some of these documents consisting of 20-plus pages each with dozens of separate pieces of text being added.


The approach I have used is as follows:

- Open the PDF using Aspose.Pdf.Document
- For each page create a TextBuilder
- For each piece of text create a TextFragment and add it via the TextBuilder
- Save the resulting PDF

For a large PDF document, i.e. 24 pages, this process takes around 0.4 seconds on the test machine using PdfSharp, but 1.4 seconds using Aspose.Pdf. As it stands, this performance is not adequate for our needs.

My question is whether the approach I have taken is the most efficient to overlay a large number of text elements to an existing PDF. I.e. should I be using PdfFileMend or something similar?

Hi Andy,


Thanks for contacting support.

Can you please share your sample PDF file so that we can test the scenario in our environment. We are sorry for this inconvenience.