summaryrefslogtreecommitdiff
path: root/source/pdf
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2017-04-21 16:48:25 +0800
committerSebastian Rasmussen <sebras@gmail.com>2017-04-21 21:08:40 +0800
commita59b4e9f1d595cdfbfaf0ac85246ad08444ddd90 (patch)
tree0bcf3a51106d9a17ab4fde8bec3af28352ba5944 /source/pdf
parent69d49ee862c464d348d7d1a3ac4f19fa0cac28a7 (diff)
downloadmupdf-a59b4e9f1d595cdfbfaf0ac85246ad08444ddd90.tar.xz
js: Extend PDF app object with a few properties.
Diffstat (limited to 'source/pdf')
-rw-r--r--source/pdf/pdf-js-util.js5
-rw-r--r--source/pdf/pdf-js.c9
2 files changed, 14 insertions, 0 deletions
diff --git a/source/pdf/pdf-js-util.js b/source/pdf/pdf-js-util.js
index 299f80ac..50a5ef39 100644
--- a/source/pdf/pdf-js-util.js
+++ b/source/pdf/pdf-js-util.js
@@ -872,3 +872,8 @@ function AFRange_Validate(lowerCheck, lowerLimit, upperCheck, upperLimit)
app.alert(util.printf("The entered value ("+event.value+") must be less than or equal to %s", upperLimit));
}
}
+
+app.plugIns = [];
+app.viewerType = "Reader";
+app.language = "ENU";
+app.viewerVersion = NaN;
diff --git a/source/pdf/pdf-js.c b/source/pdf/pdf-js.c
index 63892d98..84938d30 100644
--- a/source/pdf/pdf-js.c
+++ b/source/pdf/pdf-js.c
@@ -505,6 +505,15 @@ static void declare_dom(pdf_js *js)
/* Create the 'app' object */
js_newobject(J);
{
+#if defined(_WIN32) || defined(_WIN64)
+ js_pushstring(J, "WIN");
+#elif defined(__APPLE__)
+ js_pushstring(J, "MAC");
+#else
+ js_pushstring(J, "UNIX");
+#endif
+ js_defproperty(J, -2, "app.platform", JS_READONLY | JS_DONTENUM | JS_DONTCONF);
+
addmethod(J, "app.alert", app_alert, 4);
addmethod(J, "app.execDialog", app_execDialog, 0);
addmethod(J, "app.execMenuItem", app_execMenuItem, 1);