diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2016-11-15 14:13:47 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2016-11-16 12:24:29 +0100 |
commit | 141870506d8809723e933963e9e001aca839cdfc (patch) | |
tree | 03c5b8a20ff1e53ecc9f55ca2030f0975d97bd9b /source | |
parent | ce90119c0102092e1d743b4a1ec88c40570ff7ac (diff) | |
download | mupdf-141870506d8809723e933963e9e001aca839cdfc.tar.xz |
pdf: Use '#page=N' for remote destination pages.
As per Adobe's recommendation:
https://helpx.adobe.com/acrobat/kb/link-html-pdf-page-acrobat.html
Diffstat (limited to 'source')
-rw-r--r-- | source/pdf/pdf-annot.c | 2 | ||||
-rw-r--r-- | source/pdf/pdf-page.c | 12 |
2 files changed, 11 insertions, 3 deletions
diff --git a/source/pdf/pdf-annot.c b/source/pdf/pdf-annot.c index b500d12f..2d6aab16 100644 --- a/source/pdf/pdf-annot.c +++ b/source/pdf/pdf-annot.c @@ -146,7 +146,7 @@ pdf_parse_file_spec(fz_context *ctx, pdf_document *doc, pdf_obj *file_spec, pdf_ #endif if (pdf_is_array(ctx, dest)) - fz_snprintf(buf, sizeof buf, "#%d", pdf_to_int(ctx, pdf_array_get(ctx, dest, 0)) + 1); + fz_snprintf(buf, sizeof buf, "#page=%d", pdf_to_int(ctx, pdf_array_get(ctx, dest, 0)) + 1); else if (pdf_is_name(ctx, dest)) fz_snprintf(buf, sizeof buf, "#%s", pdf_to_name(ctx, dest)); else if (pdf_is_stream(ctx, dest)) diff --git a/source/pdf/pdf-page.c b/source/pdf/pdf-page.c index 2112040a..8335614a 100644 --- a/source/pdf/pdf-page.c +++ b/source/pdf/pdf-page.c @@ -214,8 +214,16 @@ pdf_lookup_anchor(fz_context *ctx, pdf_document *doc, const char *name) fz_catch(ctx) fz_rethrow(ctx); - uri = pdf_parse_link_dest(ctx, doc, dest); - return pdf_resolve_link(ctx, doc, uri, NULL, NULL); + if (dest) + { + uri = pdf_parse_link_dest(ctx, doc, dest); + return pdf_resolve_link(ctx, doc, uri, NULL, NULL); + } + + if (!strncmp(name, "page=", 5)) + return fz_atoi(name + 5) - 1; + + return fz_atoi(name) - 1; } static pdf_obj * |