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

Free Support Forum - aspose.com

Setting field values is slow

Setting all field values on a PDF can take an extended amount of time considering the operation. I have a sample file with about 365 fields, somewhat large, however it takes roughly 10 seconds to fill all fields.

Profiling shows that each value set will invoke get_PageIndex, which accounts for a large portion of the entire operation. Is there anything that can be done to improve performance?

var license = new License();

using (var fileStream = (new FileStream(“c:\test.pdf”, FileMode.Open)))
using (var document = new Document(fileStream))
var stopwatch = new Stopwatch();

foreach (var field in document.Form.Fields)
var checkboxField = field as CheckboxField;
if (checkboxField != null)
checkboxField.Checked = true;
field.Value = “TEST”;

var time = stopwatch.ElapsedTicks;

Hi Benjamin,

Thanks for using our API’s.

I have tested the scenario and have observed that API takes time to fill form fields inside PDF form. The time is being elapsed because all the fields inside PDF form are being filled. However for the sake of further improvements in terms of performance, I
have logged it in our issue tracking system as PDFNEWNET-39104. We will investigate this
issue in details and will keep you updated on the status of a correction.

We apologize for your inconvenience.

I just encountered the same issue on a form with 468 fields. It takes around 10 seconds to process the values.

field.PageIndex is a problem, too.

Based on the original post in this thread, it looks like PageIndex is what causes Value to process so slowly.

Hi Jeff,

Thanks for contacting support.

Can you please share the source PDF file along with the code snippet which you are using, so that we can test the scenario in our environment. We are sorry for this inconvenience.
See attached link for the form.


Aspose.Pdf.Document document = new Aspose.Pdf.Document(theFormNameAndPath);

int fieldCount = document.Form.Fields.Count(); // returns 468

foreach (Aspose.Pdf.InteractiveFeatures.Forms.Field field in document.Form.Fields)
string s = field.Value; // this line (getter) is fast
field.Value = "Text"; // this line (setter) slows it down
int fieldPage = field.PageIndex; // This line slows it down, too.

Please be sure to check both the setter and the PageIndex property for performance issues.


Hi Jeff,

Thanks for sharing your source document and code. I have tested the scenario and noticed the reported issue, so logged a separate ticket PDFNEWNET-40149 in out issue tracking system for further investigation and resolution. Furthermore, I have grouped both issues so these will be investigated together. We will keep you updated about the issue resolution progress within this forum thread.

We are sorry for the inconvenience caused.

Best Regards,

The issues you have found earlier (filed as PDFNEWNET-39104) have been fixed in Aspose.Pdf for .NET 11.3.0.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Thanks for the update!