Step 1. Create a text file named MyNotes.txt
Step 2. Create a PDF file and add a button
Step 3. Attach the text file to the PDF
Step 4. Insert this JavaScript into the Mouse Up event
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 stringvar cFile = util.stringFromStream(oFile, "utf-8");// Append new data at the end of the stringcFile += "\r\n" + v;// Convert back to a streamoFile = util.streamFromString( cFile, "utf-8");// Overwrite the old attachmentthis.setDataObjectContents("MyNotes.txt", oFile);// Read the contents of the file attachment to a multiline text fieldvar oFile = this.getDataObjectContents("MyNotes.txt");var cFile = util.stringFromStream(oFile, "utf-8");this.getField("myTextField").value = cFile;
Link to an example