Rudi
Rudi

Reputation: 61

Acrobat: How can I insert simple text using Javascript?

I want to add a simple text box and not a form field into a PDF. The code

var f = this.addField("fieldname", "text", Page_num,[x1,y1,x2,y2]);

obviously creates a form field which contaminates my PDF so that it's a form.

Thanks in advance! Rudi

Upvotes: 1

Views: 4728

Answers (1)

Max Wyss
Max Wyss

Reputation: 3615

You can not add text to the base of a document using (Acrobat) JavaScript (unless you add a field or an annotation and then flatten the page).

If you think of a text box as an annotation, you would use addAnnot(). For syntax and options of the annotation object see the Acrobat JavaScript documentation, which is part of the Acrobat SDK, downloadable from the Adobe website.

BTW, I do resent the term "contaminate"…

Upvotes: 1

Related Questions