I am wondering how to instantiate the PdfAcroForm object in iText7.
Here is the code that did previously work for me but seems to have started throwing an exception recently without change (that I can recall):
public static void ExtractValues(string filePath)
{
//The following classes read the PDF and return the fields on the form
PdfReader reader = new PdfReader(filePath);
PdfDocument document = new PdfDocument(reader);
PdfAcroForm acroForm = PdfAcroForm.GetAcroForm(document, false);
IDictionary<string, PdfFormField> fields = acroForm.GetFormFields();
}
The exception is occurring when trying to instantiate the PdfAcroForm.
Therefore I just presumed I’d be able to instantiate it by:
PdfAcroForm pdfAcroForm = new PdfAcroForm();
However when I try this I am greeted with an error stating that PdfAcroform does not contain a constructor that takes 0 arguments. However I cant find a constructor for the object at all that takes any number of arguments.
This did previously work for me so I’m not sure why it’s not all of a sudden.