From f3fcd1b3a1e1de5795041d627c101a41383cbafe Mon Sep 17 00:00:00 2001 From: Eliot Jones Date: Wed, 5 Feb 2020 10:56:01 +0000 Subject: [PATCH] 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. --- src/UglyToad.PdfPig/AcroForms/AcroFormFactory.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/UglyToad.PdfPig/AcroForms/AcroFormFactory.cs b/src/UglyToad.PdfPig/AcroForms/AcroFormFactory.cs index fef344fd..bf4aaa00 100644 --- a/src/UglyToad.PdfPig/AcroForms/AcroFormFactory.cs +++ b/src/UglyToad.PdfPig/AcroForms/AcroFormFactory.cs @@ -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(fieldsArray.Length);