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

Free Support Forum - aspose.com

Performance Problem Adding Text To Large PDF Document

Whilst evaluating Aspose.Pdf 6.2.0 for .NET, I found that adding text to PDF documents with 16 pages appears to be very slow.


Below is the code I am using and attached is the PDF:

Console.WriteLine("{0:HH:mm:ss} Started", DateTime.Now);

Document document = new Document(“Rhubarb.pdf”);

Page page = document.Pages[1];

TextBuilder pdfPageTextBuilder = new TextBuilder(page);

TextState textState = new TextState();
textState.FontSize = 10f;
textState.Font = FontRepository.FindFont(“Arial”);
textState.ForegroundColor = System.Drawing.Color.Black;

TextParagraph textParagraph = new TextParagraph();
textParagraph.AppendLine(“Test”, textState);
textParagraph.Position = new Position(50, 50);

pdfPageTextBuilder.AppendParagraph(textParagraph);

document.Save(“Populated.pdf”);

Console.WriteLine("{0:HH:mm:ss} Finished", DateTime.Now);

Console.ReadLine();

When I run this on my laptop, I see the following:

16:27:01 Started
16:27:21 Finished

So it appears to be taking 20 seconds just to add a single text item. Doing the same using PDFSharp takes a fraction of a second.

Please can you explain how I can achieve what I want? I.e. a fast way of adding text to PDF documents with 16 pages or more.

Hi Andy,

Thanks for using our products.

I have tested the scenario using the code snippet and the source PDF document while using Aspose.Pdf for .NET 6.2.0 and as per my observations, the process is completed in 5.4 seconds. Do you think its an acceptable time to write text to PDF documents.

I have tested the scenario over Intel Core2Duo 1.8Ghz with 2.5GB of RAM and base operating system of system is WindowsXp SP3. Can you please share some details regarding your working environment.

I am afraid that the performance we are seeing is not within what we can accept. My findings show me that the time taken increases almost linearly with the number of text paragraphs we add. As we need to add 100+ paragraphs, the performance at that point would be in minutes. This, to us, is not acceptable.


Thank you for your prompt response. I was concerned that I had missed something and was using the component in a way not intended.

Hi Andy,

It looks like you’re using the component in evaluation mode. I would like to share that the performance in evaluation mode is slower than the licensed version. It is due to the fact that in evaluation mode component adds evaluation checks and messages. You may find the details and get temporary license.

Please try it at your end and see if it satisfies your requirement. If you find any further questions, please do let us know.

We’re sorry for the inconvenience.
Regards,

Hi Andy,

I have again tested the scenario while excluding the licese and as per my observations, the same code is taking around 8 seconds to complete the process. The time is increased because on every single page the evaluation watermark is added. However as suggested by Shahzad, please try requesting the Temporary license and try using it and see if it improves the performance.