CodeSelectSelect is a component that allows you to highlight the selected text in a PDF.Loading... Implementation "use client"; const HighlightLayerContent = () => { const selectionDimensions = useSelectionDimensions(); const setHighlights = usePdf((state) => state.setHighlight); const handleHighlight = () => { const dimension = selectionDimensions.getDimension(); if (dimension && !dimension.isCollapsed) { setHighlights(dimension.highlights); } }; return ( <Pages className="p-4 w-full"> <Page> {selectionDimensions && <CustomSelect onHighlight={handleHighlight} />} <CanvasLayer /> <TextLayer /> <HighlightLayer className="bg-yellow-200/70" /> </Page> </Pages> ); }; const PdfHighlightSelect = () => ( <Root fileURL={fileUrl} className="flex bg-gray-50 h-[500px]" loader={<div className="p-4">Loading...</div>} > <HighlightLayerContent /> </Root> ); export default PdfHighlightSelect; This example shows: Highlighting the selected text PreviousCustom SeachNextThumbnails