Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Links are not rendered #1857

Open
4 tasks done
volosovich opened this issue Aug 14, 2024 · 3 comments
Open
4 tasks done

Links are not rendered #1857

volosovich opened this issue Aug 14, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@volosovich
Copy link

volosovich commented Aug 14, 2024

Before you start - checklist

  • I followed instructions in documentation written for my React-PDF version
  • I have checked if this bug is not already reported
  • I have checked if an issue is not listed in Known issues
  • If I have a problem with PDF rendering, I checked if my PDF renders properly in PDF.js demo

Description

I'm using react-pdf in my project on next.js 14 and my pdf file contains a list of links that are not rendered as links.
222.pdf
A file with an example is attached to this description.
There is no problem with links in a PDF file if I open it directly in the browser or any specific PDF reader tool

Steps to reproduce

  1. use your sample next-app in the repo
  2. change sample.pdf from your example to the provided file
  3. Try to click links

Expected behavior

Links should be links and should be opened in the browser.

Actual behavior

Links are not clickable.

Additional information

No response

Environment

  • Browser (if applicable): Chrome 127 (Apple MBP M2 chip)
  • React-PDF version: latest (and the same problem on old v6)
  • React version: 18.2.0
  • Bundler name and version (if applicable): next.js 14
@volosovich volosovich added the bug Something isn't working label Aug 14, 2024
@volosovich volosovich changed the title Links is not rendered Links are not rendered Aug 15, 2024
@EthanDavis
Copy link

I'm also having this issue.

@Nagavijay-beachbody
Copy link

@volosovich @EthanDavis , Did you find any alternative solution for this.? if yes, Kindly help me.

@rgarfield11
Copy link

I'm also experiencing this issue.

  • I loaded my document into the PDF.js demo and found that the link was rendered as a <span>, where I believe it should be rendered as an <a href="...">

image

  • Locally, I've imported the AnnotationLayer styles with
import 'react-pdf/dist/Page/AnnotationLayer.css';
  • I've used the props specified here to check via the console if the annotation layer is being rendered
<Document file={pdfFile} options={pdfReaderOptions}>
  <Page
    devicePixelRatio={devicePixelRatio}
    height={paneStyle.height}
    onGetAnnotationsError={(error) => console.log("error: ", error)}
    onRenderAnnotationLayerError={(error) => console.log("error: ", error)}
    onRenderAnnotationLayerSuccess={(success) => console.log("success: ", success)}
    pageNumber={documentControl.currentPage}
    renderAnnotationLayer={true}
    renderTextLayer={true}
  />
</Document>

and it is
image

@wojtekmaj - please let me know if you'd like more context, is this an issue you are working to resolve?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants