Mirian Okradze
Mirian Okradze

Reputation: 355

Pdftron Webviewer custom form field

How can I create a custom form field?

Goals I want to accomplish

There are SignatureWidgetAnnotation, CheckButtonWidgetAnnotation, but how can I control click event?

Upvotes: 1

Views: 283

Answers (1)

Ryan
Ryan

Reputation: 2570

Yes, this is definitely possible.

First you create an AfterAction entry on the Widget.

Obj aa_dict = mywidget.GetSDFObj().PutDict("AA);

Then you create your action, and add to the "U" key for click. For instance, below will add a Javascript entry.

Obj alert_js = doc.CreateIndirectDict();
alert_js.PutName("S", "JavaScript");
alert_js.PutString("JS", "app.alert(' Hello World! ');");

// Associate this JS action with 'On Mouse Up' event.
aa_dict.Put("U", alert_js);

See Table 194 here for full list of actions to hook into.

Upvotes: 0

Related Questions