react-pdf
react-pdf copied to clipboard
Addition of onClick Event Handler for Links
Before you start - checklist
- [X] I understand that React-PDF does not aim to be a fully-fledged PDF viewer and is only a tool to make one
- [X] I have checked if this feature request is not already reported
Description
Right now, there's no built-in way to add onClick events to links in the rendered PDFs. This means we can't easily make links do custom actions when clicked.
I'm curious if there's interest in adding support for onClick events for links in React-PDF. With this feature, we could make PDFs more interactive by allowing custom actions or event triggering when links are clicked.
Proposed solution
We can enhance LinkService.ts
by incorporating an onClick
attribute. We would also need to expose a new prop named onLinkClick
, which can be utilized within the document to execute custom functions.
Alternatives
No response
Additional information
No response