NSX Service Manual Navigator — AGENTS.md
Scope
Build a browser-based PDF navigator using PDF.js. Each PDF has a JSON sidecar describing interactive buttons extracted via mutool. The app overlays clickable regions and performs GoTo / GoToR navigation.
Architecture
- viewer.html loads PDF.js
- hash param selects file: viewer.html#NS9705MAINIDX.pdf
- load sidecar: NS9705MAINIDX.json
- render PDF page to canvas
- overlay clickable divs using rect coordinates
- clicking performs navigation
Sidecar Format
{ "pages": { "1": [ { "rect": [x1,y1,x2,y2], "action": { "type": "GoToR", "file": "NS9705SRSWARN.pdf", "page": 0 } } ] } }
Supported Actions
Implement only:
- GoTo (same file page jump)
- GoToR (load different PDF + page)
Ignore:
- JavaScript
- Named destinations
- Zoom modes
- Fit options
Coordinate System
Rect coordinates are PDF-space. Convert to canvas space using viewport transform.
Example: left = rect[0] * scale top = (pageHeight - rect[3]) * scale width = (rect[2] - rect[0]) * scale height = (rect[3] - rect[1]) * scale
Navigation Rules
GoTo:
- same file
- set page number
- re-render
GoToR:
- update hash to target file
- load new PDF
- jump to page
Files Codex May Modify
- pdf-view.html
- viewer.js
- styles.css
- sidecar loader utilities
Files Codex Must Not Modify
- original PDF files
- generated JSON sidecars
- mutool extraction scripts
Acceptance Criteria
- viewer.html#NS9705MAINIDX.pdf loads correctly
- clickable areas appear
- clicking loads target PDF
- page jump works
- overlay aligns with buttons
- no dependencies besides PDF.js
Commands to Run
Serve locally:
python3 -m http.server
or
npx serve .
Implementation Notes
- use absolute positioned div overlay
- pointer-events enabled
- transparent background
- optional hover highlight
Non-Goals
- full PDF form support
- text selection
- search
- zoom UI
- mobile layout
Keep implementation minimal.