Skip to content

OCR: leave a page's own design alone, and never crash the same PDF twice - #295

Merged
Joost-8 merged 1 commit into
mainfrom
ocr-text-layer-scans
Nov 22, 2026
Merged

Joost-8 merged 1 commit into
mainfrom
ocr-text-layer-scans

Conversation

@Joost-8

@Joost-8 Joost-8 commented Nov 22, 2026

Copy link
Copy Markdown
Owner

A textbook whose every page is a full-page picture of boxes and a border under real text (De finale 2025, 332 pages) was OCR'd page by page on the iPad, which crashed after 17 pages. The picture counted as a figure (TEXT_WITH_FIGURES), and the content check took the boxes' edges for content. The readings found the page's own text again.

  • classifyPage: a picture that fills the page to within 1 % of every side, under text that runs down at least half the page (textSpread, 12 bands), is the page's design and is not read. Measured with Obsidian's pdf.js over the vault: De finale goes from 332 pages read to 27, and no page changes in six slide decks or a 1,114-page textbook. Their screenshots and plots stop 37 pt and 110 pt short of an edge, so they are still read.
  • OcrService: a crash mark is stored on the device before each page (ReadingGuard, its own key). A mark left at the next start keeps that PDF from being read on the device again until its bytes or FineNotes' version change, and a notice says so.

Gates: lint, lint:review, lint:css, typecheck, build and 10,212 tests pass locally. One test failed only in the local worktree, because it reads node_modules by a relative path that the worktree lacks. Not yet tested on the iPad.

🤖 Generated with Claude Code

A textbook whose every page is a full-page picture of boxes and borders
under real text (De finale 2025, 332 pages) was OCR'd page after page: the
picture counted as a figure on a page with text (TEXT_WITH_FIGURES), and its
content check took the boxes' edges for content. The iPad drew each page at
up to 2200 px to find the page's own text again, and crashed after 17.

- classifyPage: a picture that fills the page to within 1 % of every side,
  under text that runs down at least half the page (textSpread, 12 bands),
  is the page's design and is not read. Measured with Obsidian's pdf.js
  over the vault: De finale 332 -> 27 pages read; no page changes in six
  slide decks and a 1,114-page textbook (their screenshots and plots stop
  37 pt and 110 pt short of an edge, and are still read).
- OcrService: a crash mark is stored on this device before each page
  (ReadingGuard, its own key); a mark left at the next start keeps that
  PDF from being read here again until its bytes or FineNotes' version
  change, with a notice. Reading starts at every opening, so without it a
  PDF too heavy for a device took it down each time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Joost-8
Joost-8 merged commit 06ebd11 into main Nov 22, 2026
1 check passed
@Joost-8
Joost-8 deleted the ocr-text-layer-scans branch November 22, 2026 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant