I am attempting to read different PDF files using C# and iText. When the PDF is editable my code works and the fields and values are readable. However when the PDF is in a non-editable state no fields or keys are found using my code. Is there an additional step I need to take with iText to make the non-editable PDF readable?
PdfDocument pdfDoc = new PdfDocument(new PdfReader("nonedit.pdf"));
PdfAcroForm form = PdfAcroForm.GetAcroForm(pdfDoc, true);
IDictionary<String, PdfFormField> fields = form.GetFormFields();
var keys = fields.Keys;
var keysList = new List<object>();
foreach (var item in keys)
{
keysList.Add(item);
}
Using this method finds no items in "keys" when reading a non-edit PDF.