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

Free Support Forum - aspose.com

Filling fields in a PDF form is slow

Hello,

I am using Aspose.PDF 20.5.0.0 for .Net. I am filling fields in the attached form using the code below. The call to FillField can take between 1 and 6 seconds, which seems much slower than normal. Is there a reason for this?

Aspose.Pdf.License lic = new Aspose.Pdf.License();
lic.SetLicense(@“IHT400.pdf (1.2 MB)
IHT400.pdf (1.2 MB)
Aspose.pdf.lic”);
Aspose.Pdf.Facades.Form form = new Aspose.Pdf.Facades.Form(@“IHT400.pdf”);

        for (int f = 0; f < form.FieldNames.Length; f++)
        {
            System.Diagnostics.Stopwatch sw = System.Diagnostics.Stopwatch.StartNew();

            Aspose.Pdf.Facades.FieldType fieldType = Aspose.Pdf.Facades.FieldType.Text;
            try
            {
                fieldType = form.GetFieldType(form.FieldNames[f]);
            }
            catch (Exception e)
            {
            }

            switch (fieldType)
            {
                case Aspose.Pdf.Facades.FieldType.Text:
                case Aspose.Pdf.Facades.FieldType.ComboBox:
                case Aspose.Pdf.Facades.FieldType.MultiLineText:                       
                    form.FillField(form.FieldNames[f], "test");
                    Console.WriteLine(sw.Elapsed);
                    break;
                case Aspose.Pdf.Facades.FieldType.CheckBox:                        
                    form.FillField(form.FieldNames[f], true);                           
                    break;
            }
        }

@jmurphy,

The performance of the API depends upon many factors to be noticed like Document Structure and Complexity, Graphics in the Document, Environment in which you are using the API, API version. Would you please share you complete environment with us. We will log an investigation in our system and investigate the scenario in details.

Hi,

I am using Aspose.PDF 20.5.0.0 for .Net…

OS: Windows Server 2016

8GB Ram

Xeon E5 2.1 hx processor

I’v always tried it on a Windows 10 PC with similar specs, with the same result. Note that it appears to be something specific about this form, with other forms this method is much faster.

@jmurphy,

Thanks for sharing further details.

We have logged an investigation ticket as PDFNET-48192 in our issue tracking system. We will further look into details of it and keep you posted with the status of its resolution. Please be patient and spare us some time.

We are sorry for the inconvenience.