Bug 406831

Summary: RFC compliant URL to specify page number not treated properly
Product: [Applications] okular Reporter: kdebugs.grokchem
Component: PDF backendAssignee: Okular developers <okular-devel>
Status: RESOLVED FIXED    
Severity: wishlist CC: aacid, m.weghorn, nate
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Debian stable   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=418758
Latest Commit: Version Fixed In: 1.12
Sentry Crash Report:

Description kdebugs.grokchem 2019-04-23 21:41:43 UTC
SUMMARY

The URL RFC specifies that a specific page number in a PDF may be referenced using a format like "file:///path/to/file.pdf#page=3".  This should bring the viewer directly to page 3.

STEPS TO REPRODUCE
1. okular "file:///path/to/file.pdf#page=3"

OBSERVED RESULT

Viewer opens page 1.

EXPECTED RESULT

Viewer opens page 3.

SOFTWARE/OS VERSIONS

Debian stable is used.  Okular version is 0.26.1 in Debian stable.
Comment 1 kdebugs.grokchem 2019-04-24 11:45:23 UTC
(In reply to kdebugs.grokchem from comment #0)

BTW, the relevant RFC:

https://tools.ietf.org/html/rfc3778#section-3
Comment 2 Albert Astals Cid 2019-04-24 17:52:47 UTC
#pagenumber works, shouldn't be too hard to extend i guess, but personally i don't have time to such a small corner case
Comment 3 kdebugs.grokchem 2019-04-25 13:45:20 UTC
It's strange that #pagenumber works because that does not conform to the RFC.  

Gnucash is considering adding page# support:

https://bugs.gnucash.org/show_bug.cgi?id=797212

If GC follows the RFC but okular doesn't, it could result in users complaining to GC support when the bug is in okular.
Comment 4 Michael Weghorn 2019-04-26 19:32:50 UTC
That sounds quite easy to implement. I'm taking a quick look.
Comment 5 Michael Weghorn 2019-04-27 14:12:36 UTC
Change on Phabricator: https://phabricator.kde.org/D20868
Comment 6 kdebugs.grokchem 2019-04-27 16:42:53 UTC
Thanks!
Comment 7 Albert Astals Cid 2020-09-10 14:32:45 UTC
Git commit b696d6dbfb8453948010ed786d9ab24bd3d1b485 by Albert Astals Cid, on behalf of Michael Weghorn.
Committed on 10/09/2020 at 13:30.
Pushed by aacid into branch 'master'.

Support '#page=<pagenum>' fragment to open at page <pagenum>

Support the '#page=<pagenum>' fragment to specify which page
to open the document at, in addition to the existing '#<pagenum>'
syntax.

For PDF, the '#page=<pagenum>' fragment is specified in RFC 8118,
section 3.

M  +21   -0    autotests/parttest.cpp
M  +11   -1    part.cpp

https://invent.kde.org/graphics/okular/commit/b696d6dbfb8453948010ed786d9ab24bd3d1b485