summaryrefslogtreecommitdiff
path: root/platform/gl
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2018-06-15 12:38:39 +0200
committerRobin Watts <robin.watts@artifex.com>2018-06-22 16:48:47 +0100
commit9309a8e16aea32a6466ad594109edde24243496c (patch)
treedbfaf8229d3698e8094f67363839af839bb45c7d /platform/gl
parenta8f5cda006a0042cbe19a030d6bcb777059f9714 (diff)
downloadmupdf-9309a8e16aea32a6466ad594109edde24243496c.tar.xz
gl: Add -J flag to disable Javascript in PDF forms.
Diffstat (limited to 'platform/gl')
-rw-r--r--platform/gl/gl-main.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/platform/gl/gl-main.c b/platform/gl/gl-main.c
index 044a41fe..ce63c4d2 100644
--- a/platform/gl/gl-main.c
+++ b/platform/gl/gl-main.c
@@ -93,6 +93,7 @@ static float layout_h = DEFAULT_LAYOUT_H;
static float layout_em = DEFAULT_LAYOUT_EM;
static char *layout_css = NULL;
static int layout_use_doc_css = 1;
+static int enable_js = 1;
static fz_document *doc = NULL;
static fz_page *fzpage = NULL;
@@ -674,7 +675,8 @@ static void load_document(void)
pdf = pdf_specifics(ctx, doc);
if (pdf)
{
- pdf_enable_js(ctx, pdf);
+ if (enable_js)
+ pdf_enable_js(ctx, pdf);
if (anchor)
currentpage = pdf_lookup_anchor(ctx, pdf, anchor, NULL, NULL);
}
@@ -1280,6 +1282,7 @@ static void usage(const char *argv0)
fprintf(stderr, "\t-S -\tfont size for EPUB layout\n");
fprintf(stderr, "\t-U -\tuser style sheet for EPUB layout\n");
fprintf(stderr, "\t-X\tdisable document styles for EPUB layout\n");
+ fprintf(stderr, "\t-J\tdisable javascript in PDF forms\n");
exit(1);
}
@@ -1315,7 +1318,7 @@ int main(int argc, char **argv)
int c;
glutInit(&argc, argv);
- while ((c = fz_getopt(argc, argv, "p:r:IW:H:S:U:X")) != -1)
+ while ((c = fz_getopt(argc, argv, "p:r:IW:H:S:U:XJ")) != -1)
{
switch (c)
{
@@ -1328,6 +1331,7 @@ int main(int argc, char **argv)
case 'S': layout_em = fz_atof(fz_optarg); break;
case 'U': layout_css = fz_optarg; break;
case 'X': layout_use_doc_css = 0; break;
+ case 'J': enable_js = !enable_js; break;
}
}