0
Answer

pdfsharp and inner pairs

Ask a question
Ali Mahmoud

Ali Mahmoud

11y
1.5k
1
am trying to fill the fields of pdf form 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 give error A PDF name must start with a slash (/). also the acrofields contain only one 

I dsicoverd that the document.AcroForm has 4 pairs , on of them has key "/Fields" , how to reach it


I used itextsharp , and I can read them , but am need to use pdfsharp , if any help will be highly appretiated