A browser-based PDF reader that behaves like an ebook app instead of a scrolling document viewer. Pages are locked to the frame, you flip through them, and your place is remembered — reload the tab, close the browser, come back tomorrow, and you land on the exact page you left.
Everything runs locally. PDFs are stored in IndexedDB in your own browser; no file is ever uploaded anywhere, and there is no server side.
ES modules and the PDF.js worker need http://, so opening index.html from the
filesystem will not work. Use the bundled server:
python3 serve.pyThen open http://localhost:8791 (pass a port as an argument to use another).
serve.py is http.server plus Cache-Control: no-store, so an edited .js or
.css always takes effect on reload — a plain python3 -m http.server will
happily serve you cached copies of files you just changed. To put it on the web, upload the folder to any
static host (GitHub Pages, Netlify, Cloudflare Pages) — no build step.
The mode button in the toolbar (or M) cycles through:
| Mode | Behaviour |
|---|---|
| One page | A single page fits the window and stays put. Flip to move. |
| Two pages | Facing-page spread, like an open book. Cover stands alone, then 2–3, 4–5, … |
| Scrolling | Classic continuous scroll, if you ever want it. |
Turn pages by:
- Dragging the page sideways — it follows your cursor or finger, and either completes the turn or springs back when you let go. A short flick counts too, and the first/last page tugs back instead of sliding away.
- The
‹ ›buttons in the toolbar, or the round arrows at the screen edges. - Clicking the left/right edge of the reading area.
- Arrow keys, space, PgUp/PgDn.
At Fit, scrolling does nothing at all: the page exactly fills the window, so
the reading area has overflow: hidden and there is no scrollable axis for a
wheel or trackpad to act on. The page only moves when you press down and drag it,
or press a button or key. A mouse drag that starts on a word selects text instead
of turning the page.
Fit is the minimum. Zoom is a multiple of "fills the window", with 100% as
the floor — zoomed all the way out, the page fills the frame exactly and can
never end up smaller than it or half off-screen. − is disabled at Fit; +
steps up to 400% for reading fine print. The Fit button (or 0, or clicking
the percentage) snaps straight back.
Zooming follows your cursor. ⌘/Ctrl + scroll (and trackpad pinch, which
browsers report the same way) zooms toward the pointer, so the word you are
pointing at stays exactly where it is instead of the view jumping to the middle
of the page. The + / − buttons and keys have no cursor to aim with, so they
keep the centre of the frame steady.
Zoomed in there is more page than window, so the page becomes pannable — drag it with the mouse, scroll, or swipe. Panning never turns the page. While zoomed, turning is done with the buttons, the edge arrows, or the arrow keys, so a pan can't flip by accident. Zoom stays put as you turn, and each new page starts at its top, horizontally centred.
Wide screens default to the two-page spread; narrow ones to a single page. The choice is remembered per book.
Two toolbar buttons, ⤓ and ⎙:
-
Save this page as an image — the current page (or both, in two-page mode) rendered at high resolution and downloaded as PNG.
-
Download the original PDF — the untouched file straight back out of the browser's storage. Worth knowing about: once a PDF is added here it lives only in this browser, so this is how you get it back.
-
Print — works the same in all three reading modes; opening the dialog never changes how you were reading. Three choices:
- The page you are on — whatever was on screen when you pressed Print, named explicitly ("Page 42", "Pages 50–51"). It is captured at that moment, so scrolling or turning pages afterwards cannot change what comes out.
- Pages — one field, the usual syntax:
5,3-8, or3-8, 12. Reversed ranges and duplicates are sorted out for you. - The whole book — opens the original PDF in a new tab so the browser's own viewer prints it, with no size limit.
Chosen pages are rendered to images first and printed one per sheet, which prints reliably where a live canvas often comes out blank. There is no page limit: jobs of 80 pages or more render from slightly smaller bitmaps to stay within memory, and the dialog tells you up front when a job is a long one.
-
Size — a slider from 100% to 300% with a live readout. 100% is the floor: the page already fills the sheet there, so printing only ever enlarges.
Enlarging is done here rather than by the printer: the page is rendered larger and then cropped about its centre, so the sheet gets the middle of the page with equal amounts trimmed from every edge. The bitmap grows with the zoom so enlarged prints stay sharp. The choice is remembered.
While the dialog is open, crop guides are drawn across the page itself and the part that will not print is shaded, so you can see the crop before committing to paper. The overlay is clipped to the reading area and never draws over the toolbar or the sidebar.
Two-sided printing is left to your printer's own dialog, where it belongs.
⌘/Ctrl+P opens the print options rather than printing the app's own
interface, and ⌘/Ctrl+S downloads the PDF.
Split view in the library (shown once you have two books) opens two books side by side — a commentary book next to the official one it refers to, say.
Each side is a complete, independent reader: its own page, zoom, reading mode, search, bookmarks, outline and print. Turning pages or zooming on one side never touches the other, and both sides save their reading positions separately, so closing the split leaves each book exactly where you left it.
The bar along the top picks which book is on each side, swaps them (⇄), and
evens up the divider (⊟). Drag the divider to give one side more room, or
focus it and use the arrow keys. On a phone the two books stack vertically
instead. Esc returns to the library.
Keeping a pairing. On the way out it asks once whether to keep the combination you were reading. Say yes and it joins the Split views list under the library, so next time it is one click. Combinations you were only passing through are not kept, and a pairing already on the list leaves without asking again.
The most recent sits first, up to twelve are kept, and each remembers its own
divider position, so a pairing you read with a wide left side comes back that
way. ✕ on a card forgets it, and a pairing disappears by itself if either of
its books is removed from the library.
Choosing a book that is already on the other side swaps the two rather than showing the same book twice — two panes on one book would otherwise fight over its reading position.
| Key | Action |
|---|---|
→ ←, j k, l h, PgDn PgUp |
Flip forward / back |
Space / Shift+Space |
Flip forward / back |
↓ ↑ |
Pan a zoomed-in page — never turns it |
Home / End |
First / last page |
M |
Cycle reading mode |
0 |
Back to Fit |
+ −, ⌘/Ctrl + scroll |
Zoom in up to 400% — Fit is the minimum |
S |
Contents sidebar (TOC, page thumbnails, bookmarks) |
B |
Bookmark the current page |
/ or ⌘/Ctrl+F |
Search the whole document |
⌘/Ctrl+P |
Print options |
⌘/Ctrl+S |
Download the original PDF |
T |
Cycle theme — Paper, Sepia, Dark, Night |
F |
Fullscreen |
Esc |
Close search / sidebar, else back to the library |
Night theme inverts the rendered page, so white-background PDFs become dark without washing out the text.
Per book: the PDF bytes, a cover thumbnail, page count, current page, percentage read, bookmarks, zoom and reading mode. Books are keyed by a hash of the file, so re-adding the same PDF resumes it rather than duplicating it.
"Protect from auto-cleanup" in the library footer asks the browser for persistent storage, so the library survives disk-space pressure.
index.html markup for the library and reader
style.css themes and layout
js/app.js library, ingest, routing, persistence wiring
js/reader.js the viewer: paging, flipping, zoom, search, outline
js/db.js IndexedDB access
js/pdfjs.js PDF.js setup (points at the bundled worker)
serve.py static server that disables browser caching
vendor/ PDF.js 4.10.38 + CMaps + standard fonts
Nothing is fetched from the network at runtime — PDF.js, its worker, the CMaps and the standard font set are all bundled, so PDFs with CJK text or non-embedded fonts render correctly.
There is deliberately no service worker. An earlier version had one, and its
cached app shell kept serving stale code after edits. index.html now carries a
few lines that unregister any leftover worker and clear its caches on load, so
browsers that saw the old version repair themselves on the next visit.