An extensible PDF editor that runs entirely in the browser. Open a PDF or scanned image, edit and add real text with true font metrics, mask regions, and inspect embedded text — then extend it with drop-in plugins.
Recto is a static website: a folder of files, no server-side code. MuPDF and HarfBuzz run as WebAssembly, analysis runs in workers, and the document you open never leaves your browser.
Recto's core does one thing: it opens a document, renders its pages, and exposes a plugin API. Everything else is a plugin.
web/core/— the shell. Opens the document in a MuPDF worker, rasterizes pages on demand, reports the document's typography, and hosts the viewer. It runs no analysis of its own; it hands plugins the primitives (page pixels, raw structured text) through theDocservice.web/plugins/text_tool/— edit and add text with real font metrics (HarfBuzz-shaped widths), and Affinity's Artistic and Frame text: rich text with the Character, Paragraph, Text Frame and Typography settings, columns, drop caps, OpenType features — every setting in one Text panel docked beside the page, with pair kerning and ligatures set as the page was.web/plugins/embedded_text_viewer/— inspect the text already embedded in the PDF.web/plugins/webgl_mask/— find the blacked-out regions of a scanned page and tint them on the GPU.
Optional plugins ship separately and are documented in guide/plugins/ —
nothing in the core or the list above depends on them.
A plugin is a folder under web/plugins/ with a plugin.json. Drop a folder in to add a
tool; drag it out to remove it. The manifest declares the UI slots the plugin fills (toolbar
button, ribbon bar, sidebar, scripts, styles); tools/build.mjs scans the manifests and
writes the page. At run time the plugin subscribes to lifecycle events on the PDFHooks bus —
so the core never calls a plugin by name (two exceptions, both guarded: pdf-viewer.js resets and redraws text_tool's boxes when a document is shown or closed (utbState.reset, clearAllSVGLayers, renderAllTextLayers), and the Add Box tool in app.js places its box through text_tool's handleManualAddBox), and removing one leaves nothing
dangling.
See guide/tool-expansion-guide.md to write one.
Requires: Node.js (developed with Node 22). Node is needed for the development server, the build and the tests only — there is nothing to install, and the site itself needs no Node.
node tools/serve.mjs # → http://localhost:5000
node tools/serve.mjs 8080 # another port
node tools/serve.mjs --no-isolate # without the COOP/COEP headers
node tools/serve.mjs --plugin <folder> # a plugin folder from elsewhere in place of its copy in web/plugins/Then open http://localhost:5000. The server is a zero-dependency static file server for
web/ that also runs the build on every request for index.html, so a plugin folder dropped
into or taken out of web/plugins/ shows on reload. It serves .wasm as application/wasm
and sends COOP/COEP headers (cross-origin isolation, which exposes memory measurement in the
browser). It listens on 127.0.0.1 only and is meant for development. --plugin <folder> is
for a plugin developed in a repository of its own: the page is built and served with that
folder in place of web/plugins/<name>/ (the name in its plugin.json, whatever the folder
is called), and nothing is written into web/.
The PDF directly in web/assets/pdfs/ is the startup document; without one the app starts
empty.
node --test "tests/**/*.test.mjs" # every suite — a few seconds, no browser, no dependencies
node tests/smoke/smoke.mjs # the whole site in headless Chrome, once per golden documentThe suites hold each computation to recorded reference outputs in tests/golden/: page
rasters and mask regions pixel for pixel (the drawn masks to hashes recorded here), embedded-text
spans within 1e-6, HarfBuzz widths to the last digit. They also check the generated page — script order, every control, and that a
plugin which is not there leaves no trace. A suite skips a sample document that is not in
the checkout (tests/samples/ holds a 66 MB one).
The smoke test needs Chrome and puppeteer-core. The latter is not a dependency of this
repository; the script looks for it in ./node_modules and ../tol0/node_modules and exits
with code 2 when it finds neither.
node tools/build.mjs # writes web/index.html and web/generated/*Then publish the web/ folder on any static file host. What the host has to get right:
.wasmis served asapplication/wasm— streaming compilation requires it.index.htmlandgenerated/*.jsonare revalidated (Cache-Control: no-cache).index.htmlis the one file that names every content hash.- Everything else may be cached for a long time. Every URL the page uses carries a
content hash (
?v=<first 8 hex digits of the file's sha256>), so a changed file gets a new URL. The exceptions are the few files the vendored modules import by a plain relative URL — seeweb/vendor/README.md. A cache in front of the site must keep the query string in its cache key. - COOP/COEP headers are optional. The app works without cross-origin isolation.
The page loads its icon and UI fonts from Google Fonts; everything else — every script —
comes from web/. There is no bundler, no transpiler and no package manager.
web/index.html and web/generated/ are build outputs and are not committed.
Details: guide/setup-and-deployment/.
web/ everything the static site serves
index.html GENERATED by tools/build.mjs — never edited by hand
core/ the core: page template, hook bus, document service + MuPDF worker, viewer
plugins/<name>/ one self-contained folder per plugin: plugin.json + HTML fragments + js + css
vendor/ pinned third-party WebAssembly builds (see below)
assets/fonts/ fonts.json (the font catalogue) + the face files it names
assets/pdfs/ the startup document
generated/ GENERATED: plugins.json, fonts.json, default-document.json
tools/
build.mjs the scan: web/plugins/*/plugin.json → web/index.html + web/generated/*
serve.mjs the development server
dev/ standalone maintenance scripts; not needed to run, build or test
tests/
*.test.mjs node:test suites plugins/<name>/ a plugin's own suites
golden/ recorded reference outputs samples/ the documents they were recorded from
smoke/smoke.mjs browser smoke test
guide/ documentation
A clean checkout is about 120 MB: web/ 50 MB — fonts 24, plugins 15, MuPDF 10, HarfBuzz
0.5, the startup PDF 0.6 — and tests/ 69 MB, of which the sample documents are 66.
Third-party builds the site loads at run time, copied in verbatim and pinned. Versions,
sources and upgrade notes are in web/vendor/README.md.
| Folder | What | Version | Licence |
|---|---|---|---|
web/vendor/mupdf/ |
MuPDF as WebAssembly (mupdf.js, mupdf-wasm.js, mupdf-wasm.wasm, ~10 MB) |
1.28.0 (npm mupdf@1.28.0) |
AGPL-3.0 — web/vendor/mupdf/LICENSE |
web/vendor/harfbuzz/ |
HarfBuzz as WebAssembly (index.mjs, harfbuzz.js, harfbuzz.wasm, ~0.5 MB) |
harfbuzzjs 1.6.1 = HarfBuzz 14.4.0 | MIT — web/vendor/harfbuzz/LICENSE |
The licences above are those of the vendored components as their upstreams state them; each folder carries the full text.
web/assets/fonts/ holds the face files the catalogue (fonts.json) names: the URW faces
MuPDF itself draws the base-14 fonts with (Nimbus Roman, Nimbus Sans, Nimbus Mono PS),
DejaVu Serif, and the Windows faces documents are commonly set in (Times New Roman, Arial,
Courier New, Calibri, Cambria, Georgia, Tahoma, Segoe UI, Verdana, Century Schoolbook). The
build records which files are present; a family whose files are missing stays in the font
menu marked (not installed), and measurement falls back to the nearest installed style
(tests/shaping.test.mjs needs the faces its goldens name).
Recto is free software under the GNU Affero General Public License, version 3.
It has to be: the site ships MuPDF, which Artifex licenses under the GNU AGPL, and the AGPL extends to what is built with it — including the duty to offer the full source of a system that uses it, also when it is only used over a network. Make sure you can comply before you deploy or redistribute Recto. It comes as it is, with no warranty and no support. Whoever cannot work under the AGPL needs a commercial MuPDF licence from Artifex — that covers MuPDF, not Recto's own code.
Full documentation is in guide/ — start with the
architecture overview.