-
Notifications
You must be signed in to change notification settings - Fork 386
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
Pre-Highlight using Search #176
Comments
Hey @agentcooper can you shed some light ? |
My team has been hacking on this from the parent component, using getFindController = () => window?.PdfViewer?.viewer?.findController;
search = (searchValue) => {
if (window.PdfViewer?.viewer) {
if (!this.getFindController()) {
// We re-create the PDFViewer bc the PDFFindController needs to be initialized here
window.PdfViewer.viewer = new PDFViewer({
container: window.PdfViewer.containerNode,
eventBus: window.PdfViewer.eventBus,
enhanceTextSelection: true,
removePageBorders: true,
linkService: window.PdfViewer.linkService,
findController: new PDFFindController({ eventBus: window.PdfViewer.eventBus, linkService: window.PdfViewer.linkService }),
});
window.PdfViewer.eventBus.on('updatetextlayermatches', this.calculateMatchProgress);
window.PdfViewer.init();
}
const findController = this.getFindController();
findController.executeCommand('find', {
query: searchValue,
highlightAll: true,
phraseSearch: true,
});
this.setState({ searchValue });
}
} I would love to move this internal to |
Hi @holub008 , I am able to add PDFFindController . thanks for sharing. Also I am looking to have page navigation (previous/next button to navigation between pages) as well if any idea please share how I can achieve in react-pdf-highlighter. |
Hi could you show a more complete code snippet? I'm having issues when I try to run the executeCommand on the findcontroller Thanks! |
Our team opened a PR here: #185. We package the fork, which includes some other QOL goodies, on NPM: https://www.npmjs.com/package/@darian-lp/react-pdf-highlighter It's our goal to move off the fork once the PRs are merged in, but we couldn't wait for search/zoom/rotate (standard functions on any PDF viewer) to be implemented. |
Awesome! Thanks, I'm gonna check it out! |
I just wanted to say a MASSIVE thanks to @holub008 and his team for getting this implemented in a way more dev friendly way!!! |
Hello,
How can we highlight word/section using search ? Right now the only way to Highlight any text is when you know its coordinates.
what If I am given some word or sentences, let's say via an api, and I want to highlight it when the PDF renders
is there any work-around for this ?
The text was updated successfully, but these errors were encountered: