I am trying to fill in the pdf form fields so I use the following code
string filePath = @"c:\test.pdf"; string newPath = @"E\Result"; if(File.Exists(filePath)) { PdfDocument document = PdfReader.Open(filePath, PdfDocumentOpenMode.Modify); // Get the root object of all interactive form fields PdfAcroForm form = document.AcroForm; // Get all form fields of the whole document PdfAcroField.PdfAcroFieldCollection fields = document.AcroForm.Fields; //"/Fields" string[] names = fields.Names; names = fields.DescendantNames;
the problem is that it gives an error. The PDF name must begin with a slash (/).
I dsicoverd that document.AcroForm has 4 pairs, of which it has the key "/ Fields", how to achieve it
source share