Adobe Acrobat insert text in a new doc.txt

I’m trying to save text to a new doc in adobe acrobat with javascirpt, but i can’t undestand how to do that. I created a new file in this way:

var doc = app.newDoc();

How can i insert text in it?


Acrobat JavaScript does not have access to the base plane where text etc. is residing.

What you can do is create a text annotation, place it, and finally flatten the document.

Source: stackoverflow