5 Replies Latest reply on May 9, 2016 9:55 AM by gkaiseril

    EXPORT FIELDS OF FORMS

    DEM Level 1

      Hello, I have this code, I want the output file has the file name as I do?

        • 1. Re: EXPORT FIELDS OF FORMS
          Karl Heinz Kremer Adobe Community Professional

          We need a bit more information. Were you trying to attach a document to your post? This will not work, unless it's an image.

           

          What exactly are you trying to accomplish?

          • 2. Re: EXPORT FIELDS OF FORMS
            DEM Level 1

            hello I have 50 folders within them is a cdinfo.pdf file, I want to extract the code that I have two fields of these forms, it is

            exportAsText({cPath:"/H/COPIAR/ETIQUETAS.txt", aFields: ["Text2", "Text4"]})  the problem is that all have the same name out, I do not generate anything

            I what I want is that it generates a .txt me with the information of these two fields

            • 3. Re: EXPORT FIELDS OF FORMS
              gkaiseril MVP & Adobe Community Professional

              You are specifying the same name for the exported file each time you run the script. You need to make the file name a variable and then have a naming scheme so that you do not reuse the same name. Since each PDF has a unique name you could incorporate that name into the name of the extracted file.

               

              There are a number of document properties that  one can get the file name from.  I would look at the "documentFileName" property. You will need to split the returned value to extract the file name and the file type and then use only the file name.

               

              The following line will get the file name from the file name.

               

              this.documentFileName.split(".")[0]

              Have you opened the Acrobat JavaScript file to see if you are getting any errors?

               

              The following script should work if your fields exist.

               

              try{

              this.exportAsText({cPath: "/H/COPIAR/" + this.documentFileName.split(".")[0] + ".txt", aFields: ["Text2", "Text4"]});

              } catch(eString) {

              console.show();

              console.clear();

              console.println(eString.join("\n"));

              }

              • 4. Re: EXPORT FIELDS OF FORMS
                DEM Level 1

                Hi thanks've tried your code

                TypeError: eString.join is not a function

                6:Batch:Exec

                He tells me this error

                • 5. Re: EXPORT FIELDS OF FORMS
                  gkaiseril MVP & Adobe Community Professional

                  Try this code:

                   

                  try{

                  this.exportAsText({cPath: "/H/COPIAR/" + this.documentFileName.split(".")[0] + ".txt", aFields: ["Text2", "Text4"]});

                  } catch(eString) {

                  console.show();

                  console.clear();

                  for(var i in eString) {

                  console.println(i + ": " + eString[i]);

                  }

                  }