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

Support hyperlinks in <Canvas /> #3030

Open
sehcheese opened this issue Jan 8, 2025 · 1 comment
Open

Support hyperlinks in <Canvas /> #3030

sehcheese opened this issue Jan 8, 2025 · 1 comment

Comments

@sehcheese
Copy link

react-pdf supports drawing objects via a <Canvas> and uses PDFKit under the hood, but not all of its functions are supported (the ones that are are whitelisted here). Specifically PDFKit's .link or the link option that can be passed to .text are not available (I tested in the playground). Here is what I tried in the playground:

const LinkTest = () => (
  <Document>
    <Page>
      <Canvas paint={(painter) => {
          painter.text('Here is a link!', {link: 'https://google.com'})
        }}>       
      </Canvas>
    </Page>
  </Document>
);

ReactPDF.render(<LinkTest />);

It would be great if this could be supported, or maybe any/all PDFKit functions? Thanks.

@contactsimonwilson
Copy link

FWIW, I'm currently using patch-package to just provide all pdfkit instead of the whitelisted functions in our codebase. This would be great to be available for standard releases.

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

No branches or pull requests

2 participants