diff options
author | Paul Gardiner <paul@glidos.net> | 2012-04-19 16:27:53 +0100 |
---|---|---|
committer | Paul Gardiner <paul@glidos.net> | 2012-05-08 15:12:37 +0100 |
commit | 08a925d3ff7e703e1752dbdcd0f1188ec9cee8d0 (patch) | |
tree | 905e2bc90d26fae02ad1aeb1048a0f44bbdc6e29 /pdf/pdf_form.c | |
parent | 9ebe09595ad8088f518b6397e791aa44c27a374f (diff) | |
download | mupdf-08a925d3ff7e703e1752dbdcd0f1188ec9cee8d0.tar.xz |
Implement dummy JavaScript engine just for the sake of viewing calc.pdf
Diffstat (limited to 'pdf/pdf_form.c')
-rw-r--r-- | pdf/pdf_form.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/pdf/pdf_form.c b/pdf/pdf_form.c index d1bc7576..31e1ce49 100644 --- a/pdf/pdf_form.c +++ b/pdf/pdf_form.c @@ -580,6 +580,26 @@ void pdf_synthesize_missing_appearance(pdf_document *doc, pdf_obj *obj) } } +static void execute_action(pdf_document *doc, pdf_obj *obj) +{ + pdf_obj *a; + + a = pdf_dict_gets(obj, "A"); + while (a) + { + char *type = pdf_to_name(pdf_dict_gets(a, "S")); + + if (!strcmp(type, "JavaScript")) + { + pdf_obj *js = pdf_dict_gets(a, "JS"); + if (js) + pdf_js_execute(doc->js, pdf_to_str_buf(js)); + } + + a = pdf_dict_gets(a, "Next"); + } +} + static void toggle_check_box(pdf_document *doc, pdf_obj *obj) { pdf_obj *as; @@ -673,6 +693,8 @@ int pdf_pass_event(pdf_document *doc, pdf_page *page, fz_ui_event *ui_event) changed = 1; break; } + + execute_action(doc, annot->obj); } break; } |