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

Free Support Forum - aspose.com

Unable to flatten field in PDF document created by Nuance

The attached file has several fields (including one called “Address” that I’ll use for the example below) that we are trying to flatten using something similar to the following code:

Dim Document = New Aspose.Pdf.Document(FileName)

Dim Form = New Aspose.Pdf.Facades.Form(Document)

If Form.FieldNames.Contains(“Address”) Then Form.FlattenField(“Address”)


When we run that code, a null ref exception occurs on the call to FlattenField, and the call stack looks like it’s trying to get the page index or something like that - the stack looks like this:

at Aspose.Pdf.InteractiveFeatures.Annotations.Annotation.†›(Annotation )

at Aspose.Pdf.InteractiveFeatures.Forms.Field.get_PageIndex()

at Aspose.Pdf.InteractiveFeatures.Forms.Field.Flatten()

at Aspose.Pdf.Facades.Form.FlattenField(String fieldName)

The document is created by a product called Nuance, and this appears to be a problem with many of their documents. If you open this document in Acrobat and resave it, you can successfully flatten the fields. Is there something that can be done to allow Aspose to flatten the fields in the Nuance document, or is this something we might need to take up with the makers of Nuance?


Michael Whalen

Hi Michael,

Thanks for contacting support.

I have tested the scenario using Aspose.Pdf for .NET 9.2.1 and I am getting ?a.?: Provided field name ‘Address’ doesn’t designate form field error when trying to flatten the form field. For the sake of correction, I have logged this problem
as PDFNEWNET-36972 in our issue tracking system. We will further
look into the details of this problem and will keep you updated on the status
of correction. Please be patient and spare us little time. We are sorry for
this inconvenience.


Document doc = new

//open document

Aspose.Pdf.Facades.Form pdfForm = new Aspose.Pdf.Facades.Form();


//flatten fields


//save output