-
Notifications
You must be signed in to change notification settings - Fork 209
Description
Describe the bug
Hi, I'm currently using your lib and I'm facing some issues with the links section.
I think the documentation is misleading (maybe wrong)
https://pdfviewer.net/extended-pdf-viewer/links
It says that you have to listen to the pageRendered event to get all the links displayed in the current page, but the problem is that the links are not in the DOM yet, they are present when the annotationLayerRendered event is triggered (I guess, because the links are created inside the annotationLayer).
Different types of URL links
I'm not a big PDF format specialist, but I figured that there were 2 types of links and they behave differently in PDF Js (or your lib, from my early tests, I can't really tell which does what).
-
The ones that are explicitely present in the file (I can see them with PDF editing tools, I'm using PDF XChange Editor), where you give to URL to the target. These links seems to be added correctly when the
annotationLayerRenderedis called. -
The ones that are auto-detected in the displayed text, for example https://github.com or mailto:test@gmail.com . Those links do not seem to be rendered when
annotationLayerRenderedis called, the seem to be added after. So to detect them, I need to do some tricks like set a timeout.
Could you confirm my theory and maybe have a reliable way to detect them all ?
Some random errors
I also encounter some random error when the links are displayed :
#injectLinkAnnotations: Error: `render` method must be called before `injectLinkAnnotations`.
at AnnotationLayerBuilder.injectLinkAnnotations (viewer-5.4.1105.min.mjs:31:252339)
at PDFPageView._injectLinkAnnotations (viewer-5.4.1105.min.mjs:31:322631)
at async viewer-5.4.1105.min.mjs:31:317656
I don't know if they influence the link detection or not ?
Full stack here :
PDF JS injectLinkAnnotations render error.txt
Version info
- I'm using ngx-extended-pdf-viewer version 25.6.4
Demo PDF file
I created a simple PDF with both types of links :
Thanks