XFA Form SetField method not working!

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

XFA Form SetField method not working!

I am using the below code to write to a field in a XFA form. I am just trying to enter a field value to the form & when i open the form i dont see the changes. Any idea what i am doing wrong.
 private void FillData1()

            string pdfTemplate = @"C:\Prs\Report.pdf";

            // title the form
            this.Text += " - " + pdfTemplate;

            // create a new PDF reader based on the PDF template document
            PdfReader pdfReader = new PdfReader(pdfTemplate);
            XfaForm xfa = new XfaForm(pdfReader);
            using (MemoryStream ms = new MemoryStream())
                using (PdfStamper stamper = new PdfStamper(pdfReader, ms))
                    AcroFields form = stamper.AcroFields;
                                      form.SetField("Brm[0].SNarrative[0].ExplanationOrDescription[0]", "Priya B");

                                  }            }