- PDF pages rendered by PDF.js directly from File object (no conversion shown)
- Each page gets a transparent overlay canvas for drawing highlights
- Word positions extracted from PDF.js getTextContent() in PDF coordinate space
- convertToViewportPoint() maps PDF space → canvas pixels correctly (handles y-flip)
- On each sentence: purple highlight rectangles drawn over matching words on the PDF
- Sentence→word mapping via character-position search through word stream
- PDF rendering and text extraction run in parallel (pages appear as they render)
- Nextcloud PDFs use pdf_b64 → PDF.js rendering path
- Removed iframe approach entirely
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>