on-internet
← Community

Search highlights don't match the expected word. How can I fix the highlight accuracy?

Stack Overflow ·

I'm using PDF.js to render a PDF document from a URL in React. The PDF loads fine, but I'm facing an issue with search: When using the PDFFindController to highlight search terms, the highlights don't align correctly with the actual text—they're often offset or covering incorrect words. What I’ve tried: Adjusting currentScaleValue Tweaking textLayerMode (currently using scale) Confirmed the PDF itself is fine (rendered correctly elsewhere) useEffect(() => { const loadPDFViewer = async () => { try { const { PDFViewer, PDFLinkService, PDFFindController, EventBus } = await import('pdfjs-dist/web/

Comments

Sign in or sign up to comment and upvote.

No comments yet.