view_page: draw the printed page under the ink on PDF and EPUB pages #105

Merged
jfro merged 1 commit from feat-100-view-page-pdf into main 2026-11-27 18:25:16 +00:00
Owner

What changed

view_page now composites the pdftoppm-rasterized PDF page under the ink, placed like the web viewer (fit by aspect ratio, centered, from the top); OCR stays ink-only. Proven by a red-then-green MCP test checking printed-text and ink pixels, a blank-PDF-page case and a missing-PDF fallback, plus the full suite and green CI.

Fixes #100

Red, then green

  • view_page on an annotated PDF page returns the printed page (its text pixels) with the ink in place, a blank PDF page shows its printed text, and a missing PDF falls back to ink with a caption saying so.: bash -lc 'eval "$(mise activate bash --shims)"; mix test test/rm_analyzer_web/notes_mcp_agent_test.exs'
    • fails on the base (38202c1): exit 1
    • passes on the branch (1ac56d4): exit 0

Checks

  • The full suite passes on the branch (1595 tests) and CI on PR #105 is green. (Upper Wolfjaw): bash -lc 'eval "$(mise activate bash --shims)"; mix test && curl -sf -H "Authorization: token $FORGEJO_TOKEN" https://git.knope.dev/api/v1/repos/jfro/rm-analyzer/commits/1ac56d4/status | jq -e ".state == \"success\""', exit 0
  • Read the diff: placement math matches Scene.fit_pdf and the web viewer, OCR path untouched, missing-PDF/pdftoppm/blank-page fallbacks sound; format clean, MCP tests and full suite (1595) pass. Untested: real Paper Pro page, rotated PDFs, performance on large PDFs. (Prover): bash -lc 'cd /home/peak/work/rm-analyzer-plan-review-loop/rm-analyzer && eval "$(mise activate bash --shims)"; mix test test/rm_analyzer_web/notes_mcp_agent_test.exs', exit 0

Risks

Only checked against the 225x150 pt fixture on older-firmware (scaled) pages; not yet tried on a real Paper Pro page with a recorded paper size or a rotated PDF, though the placement math matches the web viewer. Each view_page on a PDF page now runs pdfinfo, pdftoppm and rsvg-convert (not cached), so it's slower than the ink-only render.

Prover

Passed (Sonnet): Read the diff: placement math matches Scene.fit_pdf and the web viewer, OCR path untouched, missing-PDF/pdftoppm/blank-page fallbacks sound; format clean, MCP tests and full suite (1595) pass. Untested: real Paper Pro page, rotated PDFs, performance on large PDFs.

Every command above was run by Fortysix's Basecamp itself, on the branch named.

## What changed view_page now composites the pdftoppm-rasterized PDF page under the ink, placed like the web viewer (fit by aspect ratio, centered, from the top); OCR stays ink-only. Proven by a red-then-green MCP test checking printed-text and ink pixels, a blank-PDF-page case and a missing-PDF fallback, plus the full suite and green CI. Fixes #100 ## Red, then green - view_page on an annotated PDF page returns the printed page (its text pixels) with the ink in place, a blank PDF page shows its printed text, and a missing PDF falls back to ink with a caption saying so.: `bash -lc 'eval "$(mise activate bash --shims)"; mix test test/rm_analyzer_web/notes_mcp_agent_test.exs'` - fails on the base (38202c1): exit 1 - passes on the branch (1ac56d4): exit 0 ## Checks - The full suite passes on the branch (1595 tests) and CI on PR #105 is green. (Upper Wolfjaw): `bash -lc 'eval "$(mise activate bash --shims)"; mix test && curl -sf -H "Authorization: token $FORGEJO_TOKEN" https://git.knope.dev/api/v1/repos/jfro/rm-analyzer/commits/1ac56d4/status | jq -e ".state == \"success\""'`, exit 0 - Read the diff: placement math matches Scene.fit_pdf and the web viewer, OCR path untouched, missing-PDF/pdftoppm/blank-page fallbacks sound; format clean, MCP tests and full suite (1595) pass. Untested: real Paper Pro page, rotated PDFs, performance on large PDFs. (Prover): `bash -lc 'cd /home/peak/work/rm-analyzer-plan-review-loop/rm-analyzer && eval "$(mise activate bash --shims)"; mix test test/rm_analyzer_web/notes_mcp_agent_test.exs'`, exit 0 ## Risks Only checked against the 225x150 pt fixture on older-firmware (scaled) pages; not yet tried on a real Paper Pro page with a recorded paper size or a rotated PDF, though the placement math matches the web viewer. Each view_page on a PDF page now runs pdfinfo, pdftoppm and rsvg-convert (not cached), so it's slower than the ink-only render. ## Prover Passed (Sonnet): Read the diff: placement math matches Scene.fit_pdf and the web viewer, OCR path untouched, missing-PDF/pdftoppm/blank-page fallbacks sound; format clean, MCP tests and full suite (1595) pass. Untested: real Paper Pro page, rotated PDFs, performance on large PDFs. Every command above was run by Fortysix's Basecamp itself, on the branch named.
feat(mcp): view_page draws the printed page under the ink on PDF and EPUB pages
All checks were successful
CI / test (pull_request) Successful in 1m53s
1ac56d4dd0
Rasterizes the PDF page with pdftoppm, fitted to the page as the tablet and
the web viewer place it, and composites the ink SVG on top. OCR still reads
the ink alone. Falls back to the ink when the printed page can't be drawn.

Closes #100
jfro merged commit 9c293f5165 into main 2026-11-27 18:25:16 +00:00
jfro deleted branch feat-100-view-page-pdf 2026-11-27 18:25:16 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jfro/rm-analyzer!105
No description provided.