pdf-accessibility/uploads/test_visual_demo.pdf
DJP 2952731bd6 Fix coordinate scaling for visual markers
Issue: Marker boxes were misaligned with actual PDF content
Cause: Coordinate system mismatch between PDF (72 DPI) and rendered images (150 DPI)
Fix: Apply proper DPI scaling factor to coordinates

Changes:
- Calculate scale factor: DPI / 72 (e.g., 150/72 = 2.083)
- Scale all x/y coordinates before drawing
- Store page_image_dpi in JSON for frontend
- Add debug console logs to verify scaling

Formula:
- pixel_coordinate = pdf_coordinate × (image_dpi / 72)
- Example: 100 points @ 150 DPI = 208 pixels

Now markers should align perfectly with PDF content!

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-20 16:31:02 -04:00

17 KiB