Closed Defcon0 closed 9 years ago
It can be a bug. Can you provide a link to such PDF document?
Big thanks for your reply. Since it's an urgent project, I've been hoping that you guys reply quickly ;)
Concerning your question: Mhm, difficult, it's internal data. But I'll try to get you a copy without internal data.
But I think, it's just that the linkService hasn't been passed through correctly.
Hard to tell, but #5971 might help
That didn't work out.
I prepared you a simple pdf with an internal link from page 1 to page 2 and vice versa (ATTENTION: In order to upload it to github I had to replace the file extension pdf by png, you'll have to change at first ;-) ):
I have a file that reproduces this issue. I'm using the version 1.6.234
I don't see a problem with this file using the latest version (https://mozilla.github.io/pdf.js/web/viewer.html). It's also a custom viewer in the screenshot, so something else may also be causing this error.
Thanks for your quick response, Tim. Yes, we do use a custom view on top of PDF JS to provide some additional feature/information. I'll investigate the integration in our code base to see why this error is thrown.
@timvandermeij I've just encountered this error too and we're writing a custom viewer.
The AnnotationLayer class in src/display depends on two parameters (linkService and downloadManager) that are Web interfaces (e.g. IPDFLinkService). If we're writing a custom viewer we'll need to implement those ourselves, as I cannot find them exposed in the pdfjs-dist build (for various reasons we're still using the script directly instead of in webpack)
Documentation is a bit missing in this area so I'm a bit lost :(
Yes, either implement the interfaces yourself or take the original implementation from https://github.com/mozilla/pdf.js/tree/master/web.
Hello,
I'm in trouble setting up the pageviewer.js-example of the src-package I "make'd" with node. When using a pdf containing a pdf-internal link (one page to another) and rendering a page containing a link, I get:
Uncaught (in promise) TypeError: Cannot read property 'getDestinationHash' of undefined at bindLink (http://fs.local/system/modules/pdf_viewer/assets/js/vendor/pdf.js-src/build/components/pdf_viewer.js:1540:32) at http://fs.local/system/modules/pdf_viewer/assets/js/vendor/pdf.js-src/build/components/pdf_viewer.js:1620:19
I'm using: https://github.com/mozilla/pdf.js/blob/master/examples/components/pageviewer.js
The property which is missing, is linkService in
link.href = linkService.getDestinationHash(dest);
in setupAnnotations in pdf_viewer.js.
Any help would be highly appreciated. Is it a bug or am I doing something wrong???
Bye Defcon0