Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Problem with autofill Fields in interactive pdf via C#.

New Here ,
Jan 13, 2017 Jan 13, 2017

Hello,

I have problem with autofill Fields in interactive pdf via C#.

Method myFields.GetEnumerator() returns empty enumerator.

IEnumerator myEnumerator = myFields.GetEnumerator();

           String FORM_NAME = Application.StartupPath + "\\PIT-11(23)_v1-0E_2016.pdf";

           

            CAcroApp acroApp = new AcroAppClass();           

            acroApp.Show();

            CAcroAVDoc avDoc = new AcroAVDocClass();

            // Open the pdf

            if (!avDoc.Open(FORM_NAME, ""))

            {

                string szMsg = "Cannot open" + FORM_NAME + ".\n";

                Console.WriteLine(szMsg);

                return;

            }

           

            try

            {

                // Create a IAFormApp object, so that we can access the form fields in  the open document

                IAFormApp formApp = new AFormAppClass();

                IFields myFields = (IFields)formApp.Fields;

                IEnumerator myEnumerator = myFields.GetEnumerator();//EMPTY ENUMERATOR!!!!!

                while (myEnumerator.MoveNext())

                {

                    IField myField = (IField)myEnumerator.Current;

                    // If the field is "Name", set it's value to "John Doe"

                    if (myField.Name == "Name")

                    {

                        myField.Value = "John Doe";

                        break;

                    }

                }

                return;

            }

            catch (Exception ex)

            {

                MessageBox.Show(ex.Message);

            }

TOPICS
Acrobat SDK and JavaScript
327
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 30, 2017 Apr 30, 2017
LATEST

Are there form fields in the document?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines