stephanrauh / ngx-extended-pdf-viewer

A full-blown PDF viewer for Angular 16, 17, and beyond
https://pdfviewer.net
Apache License 2.0
449 stars 167 forks source link

link not working #2381

Closed alexucgit closed 2 days ago

alexucgit commented 1 week ago

I have a pdf with annotations and various links, also links to websites and emails. The pdf works correctly and if I open it with Adobe the links work. However, if I view it with ngx the links are not recognised

    <ngx-extended-pdf-viewer *ngIf="pdfSource"
      [src]="pdfSource"
      [minifiedJSLibraries]="false"
      height="100%"
                             [handTool]="false"
                             [showHandToolButton]="false"
      (pageChange)="pageChange($event)"
      [showToolbar]="true"
      [showZoomButtons]="true"
      [enableDragAndDrop]="false"
      [showRotateButton]="false"
      [showDownloadButton]="false"
      [showOpenFileButton]="false"
      [showPrintButton]="false"
      [showHighlightEditor]="false"
      [showTextEditor]="false"
      [showSecondaryToolbarButton]="false"
      [showDrawEditor]="false"
      [showBookModeButton]="false"
      [listenToURL] = "true"
      [sidebarVisible]="true"
      [textLayer]="true"
    ></ngx-extended-pdf-viewer>
alexucgit commented 1 week ago
<section data-annotation-id="37R" tabindex="1000" class="linkAnnotation" 
  style="z-index: 1; left: 35.9423%; top: 39.9934%; width: 1.00781%; height: 0.823754%;">
  <a data-element-id="37R" title="https://www.normattiva.it/uri-res/N2Ls?urn:nir:stato:regio.decreto:1940-10-28;1443:1~art176!vig=" href="https://www.normattiva.it/uri-res/N2Ls?urn:nir:stato:regio.decreto:1940-10-28;1443:1~art176!vig=" target="" rel="noopener noreferrer nofollow" id="pdfjs_internal_id_37R">
  </a></section>

I discovered that the link only reads it at the beginning of the first character of each word

alexucgit commented 1 week ago

same pdf with pdf-viewer work perfectly

stephanrauh commented 1 week ago

When you say it's working with "pdf-viewer" - which application or library are you referring to?

stephanrauh commented 1 week ago

I also suspect that's a problem of a specific PDF file. Can you share the file with us?

alexucgit commented 4 days ago

No, it is a document that cannot be shared unfortunately. The annotation is created with pdfbox on a layer above the textlink. So where there is an annotation the textlink is not clickable. If I open the document with a reader it works correctly

stephanrauh commented 4 days ago

You've opened a new ticket. Does this mean you've managed to get clickable links?

alexucgit commented 3 days ago

no! I simply replaced the highlighting with a rectangle that underlines the text link and therefore the textlink is clickable

stephanrauh commented 2 days ago

Looking at the width of the link that's rendered: I suppose you have to point very carefully to find it, so technically it is rendered, but obviously not correctly. However, that part of the library is not my code. I reckon you can reproduce the bug on https://mozilla.github.io/pdf.js/web/viewer.html. There's an "open file" menu, it just hides shyly in the secondary menu.

If you can reproduce the bug over there, it's a bug that affects every Firefox user. Please report it at https://github.com/mozilla/pdf.js.

stephanrauh commented 2 days ago

I've closed the ticket because I believe the pdf.js team has to care about it. If I'm wrong, don't hesitate to drop a comment. Then I have to check my code for broken merges.