2 Replies Latest reply on Dec 23, 2010 9:10 PM by dying veteran

    how to write text file in acrobat javascript

    subhaoviya Level 1

      Hi,

       

      I need to write a txt file from acrobat javascript. How can i do this?

       

      My requirement is to get identity mail id and name? Using acrobat javascript i can able to take mail id as identity.email. I get the mail id as alert and in console

       

      How can i write this mail id to text file?

       

      Thanks in advance...

        • 1. Re: how to write text file in acrobat javascript
          try67 MVP & Adobe Community Professional

          Look in the reference for the methods related to the Data object.

          • 2. Re: how to write text file in acrobat javascript
            dying veteran Level 1

            Hi,

             

            here is a commented program stanza

             

             

             

            var v = this.getField("myTextField").value;

            // Get the contents of the file attachment with the name "MyNotes.txt"

            var oFile = this.getDataObjectContents("MyNotes.txt");

            // Convert the returned stream to a string

            var cFile = util.stringFromStream(oFile, "utf-8");

            // Append new data at the end of the string

            cFile += "\r\n" + v;

            // Convert back to a stream

            oFile = util.streamFromString( cFile, "utf-8");

            // Overwrite the old attachment

            this.setDataObjectContents("MyNotes.txt", oFile);

            // Read the contents of the file attachment to a multiline text field

            var oFile = this.getDataObjectContents("MyNotes.txt");

            var cFile = util.stringFromStream(oFile, "utf-8");

            this.getField("myTextField").value = cFile;

             

             

             

             

             

            [signature deleted by host]