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

Free Support Forum - aspose.com

Performance to create- fill and save PDF form

The time it takes for Aspose to create, fill and save a PDF form to Stream is significant in the range of more than 3-12 seconds consistently.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Is there any way to improve the code or reduce the time it takes?

Currently, we have the requirements to fill out approximately 100,000 PDF forms using the same template.

Here is a sample code below:

[Test]

public void TestPerformance()

{

Stopwatch stopwatch = new Stopwatch();

stopwatch.Start();

// get PDF form template

string PdfResource = "template.pdf";

Stream templatePdf = Assembly.GetAssembly(typeof(CustomService)).GetManifestResourceStream(PdfResource);

// deep copy template for async purpose (async not shown here)

var bytes = new byte[templatePdf.Length];

templatePdf.Seek(0, 0);

templatePdf.Read(bytes, 0, Convert.ToInt32(templatePdf.Length));

// create and fill Aspose PDF Form object

Form form;

using (Stream template = new MemoryStream(bytes))

{

form = new Form(template);

form.FillField("PayerName", "FirstAndLastName");

form.FlattenAllFields();

var contentStream = new MemoryStream();

form.Save(contentStream);

byte[] letterContent = contentStream.ToArray();

}

stopwatch.Stop();

Assert.IsTrue(stopwatch.ElapsedMilliseconds == 0, "should take 0 ms but took " + stopwatch.ElapsedMilliseconds + " ms");

}

Performance results:

Run 1: The stopwatch section took 4894 ms.

Run 2: The stopwatch section took 3054 ms.

Run 1: Breakdown:

0 ms // get PDF form template

15ms // deep copy template

4879ms // create and fill Aspose PDF Form object

Run 2: Breakdown:

0 ms // get PDF form template

34ms // deep copy template

3020ms // create and fill Aspose PDF Form object

Hi Maria,


Thanks for your inquiry. We’ve already logged your reported performance issue as PDFNEWNET-35338 in our issue tracking system. As soon as our development completes their analysis, I’ll notify you via this forum thread.

Sorry for the inconvenience faced.

Best Regards,