How do I flatten PDF forms and remove JavaScript actions

Q: I am populating a PDF template by completing text fields and want
to flatten them before publishing the document (using
pdftron.PDF.PDFDoc.FlattenFields()).

After I flatten them, when someone opens the document in Adobe Reader
they see "Fill out the form" notice. How do I flatten fields so that
they become read only fields, flat text annotations, or remove the
form property all together?
------------------
A: It seems that in your document contains a JavaScript action as
document 'OpenAction'. You can remove the action using:

pdfdoc.GetRoot().Erase("OpenAction");