Flattening a field hangs if the field is filled

I am trying to fill a field of PDF using Aspose.Pdf, and then I would like to flatten the PDF so it is not editable when saved. I have tried the following in my code:

TextBoxField customerNumber = (TextBoxField) form.get(“Customer Number”);
customerNumber.setValue(“111”);
customerNumber.flatten();

When the flatten() method runs, the program hangs. The method never completes, and I cannot figure out why. If I do not set the value of the field before flattening, the flatten() method works fine. Is there something I am doing wrong?

Hi Samantha,


Thanks for using our API.

The problem appears to be related to particular PDF file which you are using, so can you please share the resource file so that we can test the scenario in our environment. We are sorry for this inconvenience.