initialBookmark doesn't work as expected, possible regression from #2914 #3068

Snuffleupagus opened this Issue Apr 9, 2013 · 2 comments


None yet
2 participants

Snuffleupagus commented Apr 9, 2013

It appears that specifying a destination in the hash when loading a PDF file no longer works as it used to. For example, try opening: You expect to be taken straight to section 1.1 when the document loads, but instead page 1 will be shown.

I've found that the issue seems to be that when the document is loaded, pagesRefMap hasn't been initialized yet, which causes the pageNumber lookup to fail here:

This used to work, but I haven't tried to find the exact regression range, but as far as I know the only recent PR that touched code relating to pagesRefMap is #2914.

@mduan Is it possible that #2914 caused this? If that is the case, can it be fixed?


Snuffleupagus commented Apr 19, 2013

I have found that after #2719 was merged, specifying a destination as initialBookmark will instead fail at: The reason is that with progressive loading, PDFView.destinations doesn't exist yet, when it's called from the navigateTo function. This makes perfect sense to me, but causes a less than perfect user experience.

I've taken a stab at implementing a workaround for this issue. It seems to be working as it should in my testing, but might not be the most optimal solution. It is currently available here: Snuffleupagus/pdf.js@8a9baa3.
If this workaround is sufficiently good, I would be happy to submit a PR.


mduan commented Apr 23, 2013

Fixed by PR above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment