From 87c2ff5483e043c6e75e4c0c3073d0b5ec86133c Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Thu, 27 Oct 2016 21:39:05 +0200 Subject: [PATCH] Remove/deprecate specifying a pageNumber directly after the hash symbol (#), to improve compatibility since other PDF viewers don't support this form (issue 7746) There's no mention of our `#{pagenum}` form in http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_open_parameters.pdf, and Adobe Reader doesn't seem to support it either. Hence this patch removes support for it in the extensions, but keeps it in the `GENERIC` build with a deprecation warning and a fallback to handle it as a destination. Fixes 7746. --- web/pdf_link_service.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/web/pdf_link_service.js b/web/pdf_link_service.js index 8f8f17b1a..7dd7478d0 100644 --- a/web/pdf_link_service.js +++ b/web/pdf_link_service.js @@ -270,9 +270,15 @@ var PDFLinkService = (function PDFLinkServiceClosure() { mode: params.pagemode }); } - } else if (isPageNumber(hash)) { // Page number. - this.page = hash | 0; } else { // Named (or explicit) destination. + if ((typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC')) && + isPageNumber(hash) && hash <= this.pagesCount) { + console.warn('PDFLinkService_setHash: specifying a page number ' + + 'directly after the hash symbol (#) is deprecated, ' + + 'please use the "#page=' + hash + '" form instead.'); + this.page = hash | 0; + } + dest = unescape(hash); try { dest = JSON.parse(dest);