The study problem
Many chess books separate explanation from replay. The reader follows a dense two-column PDF while switching to another application to locate and navigate the referenced game.
This project places the game collection, current board position, and one readable book column in the same workspace without uploading the source files.
Application architecture
The application remains a static set of HTML, CSS, and ES modules. PDF.js renders local PDF bytes, cm-pgn parses annotated multi-game PGNs, cm-chessboard displays each FEN, and a dedicated Web Worker runs Stockfish analysis without blocking the workspace.
A local ONNX recognition pipeline detects printed diagrams on the active PDF page, classifies all 13 square states, and converts reliable reads to FEN. Exact positions open their PGN game; unmatched positions become setup-position games at the end of the study PGN.
Rendering one PDF column
A PDF page is rendered through a translated canvas transform so only the selected reading region appears. The sequence advances left column, right column, then the next page.
Books and scans do not always split at exactly half the page, so the reader stores adjustable split, center-trim, and outer-trim values for the active book.
Local data and persistence
Selected PDF and PGN files, diagram recognition, and Stockfish analysis are processed in the browser. IndexedDB provides best-effort restoration of the active study, while a clear action removes the stored session.
All imported headers, comments, and filenames are rendered as text rather than executable markup.
Current limitations
- Diagram recognition targets axis-aligned 2D boards; low-confidence reads are rejected instead of creating an unreliable game.
- Engine analysis uses a lightweight single-threaded Stockfish build and does not include cloud analysis or tablebases.
- A generated position defaults to White to move because a diagram alone does not encode the active color or move history.
- Browser storage may be cleared or evicted by the browser.