diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2017-04-10 15:33:28 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2017-04-13 13:16:21 +0200 |
commit | ddc33abe12704be1a95c39c51796028dd70ce56d (patch) | |
tree | 7689627a29e97c7807fe4a4bedae519f4dd6e659 /platform/gl | |
parent | 9536658e3820bcd285a49de0d40283e3d5cc6a08 (diff) | |
download | mupdf-ddc33abe12704be1a95c39c51796028dd70ce56d.tar.xz |
gl: Support going to a specific page number on the command line.
Diffstat (limited to 'platform/gl')
-rw-r--r-- | platform/gl/gl-main.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/platform/gl/gl-main.c b/platform/gl/gl-main.c index fee7d40c..a013bdef 100644 --- a/platform/gl/gl-main.c +++ b/platform/gl/gl-main.c @@ -144,6 +144,7 @@ static int zoom_out(int oldres) static char filename[2048]; static char *password = ""; +static char *anchor = NULL; static float layout_w = DEFAULT_LAYOUT_W; static float layout_h = DEFAULT_LAYOUT_H; static float layout_em = DEFAULT_LAYOUT_EM; @@ -767,7 +768,17 @@ static void reload(void) pdf = pdf_specifics(ctx, doc); if (pdf) + { pdf_enable_js(ctx, pdf); + if (anchor) + currentpage = pdf_lookup_anchor(ctx, pdf, anchor, NULL, NULL); + } + else + { + if (anchor) + currentpage = fz_atoi(anchor) - 1; + } + anchor = NULL; currentpage = fz_clampi(currentpage, 0, fz_count_pages(ctx, doc) - 1); @@ -1440,7 +1451,7 @@ int main(int argc, char **argv) if (fz_optind < argc) { - fz_strlcpy(filename, argv[fz_optind], sizeof filename); + fz_strlcpy(filename, argv[fz_optind++], sizeof filename); } else { @@ -1453,6 +1464,9 @@ int main(int argc, char **argv) #endif } + if (fz_optind < argc) + anchor = argv[fz_optind++]; + title = strrchr(filename, '/'); if (!title) title = strrchr(filename, '\\'); |