Skip to main content

doclens

Universal document viewer for the web.

One component. Any file. Full-text search with OCR.

npm install doclens
import { DocViewer } from 'doclens';

<DocViewer document={{ uri: '/report.pdf' }} />

That's it. Renders PDFs, spreadsheets, presentations, code, media, and more — with search, zoom, and dark mode built in.

Why doclens?

doclensreact-doc-viewer@cyntler/react-doc-viewer
Formats14+ (PDF, XLSX, CSV, PPTX, DOCX, XML, JSON, HTML, MD, images, video, audio, text)77
SearchUnified across all formats with highlighting & keyboard navNoneNone
OCRTesseract.js for scanned PDFs and imagesNoneNone
PDF enginePDFium via pdfnova (Chrome-grade rendering)PDF.jsGoogle Docs iframe
Pre-searchAuto-highlight terms on loadNoneNone
ZoomKeyboard, pinch, fit-to-widthBasicNone
ThemingCSS variables, light/dark presetsLimitedLimited
Multi-documentTabbed UI with switcherNoneNone
TypeScriptFirst-class, fully typedPartialYes
Tree-shakeableDynamic imports per formatNoNo

Features

  • 14+ file formats rendered client-side with no server required
  • Unified search & highlight across all text-based formats
  • OCR support — search text in images and scanned PDFs via Tesseract.js
  • Pre-search — pass terms to auto-highlight and scroll to on load
  • Keyboard navigation — Enter/Shift+Enter between matches
  • Zoom controls — pinch-to-zoom, Ctrl+/-, fit-to-width
  • Remote URL support — S3, CDN, authenticated endpoints
  • Multi-document tabs — switch between documents in one viewer
  • Password-protected PDFs — automatic password prompt
  • Dark mode — light and dark themes with CSS custom properties
  • Framework-agnostic — core engine works with vanilla JS; React wrapper for convenience
  • Tree-shakeable — format-specific dependencies are dynamically imported
  • Customizable — CSS variables, render slots, custom renderers

Supported Formats

FormatExtensionLibrarySearch
PDF.pdfpdfnova (PDFium)Yes (text layer + OCR)
Excel.xlsx, .xlsxlsx (SheetJS)Yes
CSV.csvpapaparseYes
PowerPoint.pptxBuilt-inYes
Word.docxmammothYes
XML.xmlBuilt-inYes
JSON.jsonBuilt-inYes (tree view)
HTML.htmlShadow DOMYes
Markdown.mdmarkedYes
Images.png, .jpg, .gif, .webp, .svgNative + OCRYes (via OCR)
Video.mp4, .webm, .oggNativeNo
Audio.mp3, .wav, .flacNativeNo
Plain Text.txt, .logNoneYes