ignore form dictionaries that do not contain fields #131

though a form dictionary should always contain fields (as required by the spec) it is possible for this entry to be missing. in this case we return false for trygetform.
This commit is contained in:
Eliot Jones
2020-02-05 10:56:01 +00:00
parent 40dc80c281
commit f3fcd1b3a1

View File

@@ -82,12 +82,10 @@
{
q = qToken.Int;
}
var fieldsToken = acroDictionary.Data[NameToken.Fields.Data];
if (!DirectObjectFinder.TryGet(fieldsToken, tokenScanner, out ArrayToken fieldsArray))
if (!acroDictionary.TryGet(NameToken.Fields, tokenScanner, out ArrayToken fieldsArray))
{
throw new PdfDocumentFormatException($"Could not retrieve the fields array for an AcroForm: {acroDictionary}.");
return null;
}
var fields = new Dictionary<IndirectReference, AcroFieldBase>(fieldsArray.Length);