This repo is a TypeScript React library for PDF annotation/highlighting built on PDF.js.
- The public API lives in
src/index.ts; edit source files insrc/andsrc/style/. dist/is build output; do not edit it directly.- The
example/app is for demos only; avoid changing it unless requested.
- Build the library:
npm run build. - Type-check:
npm run compile. - Lint/format:
npm run lintandnpm run format. - E2E demo tests (Playwright):
npm run test:e2e.
PdfLoaderwraps PDF.js document loading and worker configuration.PdfHighlighterowns PDF.jsPDFViewer, listens for selection/scroll events, and renders per-page highlight layers.- Coordinate conversions live in
src/lib/coordinates.tsand are used by the highlight pipeline.