PDFLab — Click-to-Edit PDF Editor (HTML + Python · PyMuPDF)

Freev1.0.0

Click any line of a PDF, retype it, and export a file that keeps the document's own typography — plus a full markup toolbar.

PDF EditorHTMLPYTHONPyMuPDFExtract pdf text

PDFLab — Click-to-Edit PDF Editor (HTML + Python · PyMuPDF)

$0

PDFLab v1.0.0.zip · 3 MB

Free forever · MIT license · Personal license key

0 Wholesaas team
0 ratings
Sign in to rate
pdflab-click-to-edit-pdf-editor-html-python-pymupdf/screenshot-1
Free
PDFLab — Click-to-Edit PDF Editor (HTML + Python · PyMuPDF) screenshot 1
Full page

Overview

PDFLab turns a browser tab into a working PDF editor: click any line of text in

the document, type over it, and export a file that keeps the original

typography. The trick is that **nothing is edited in the browser** — the page on

screen is a preview drawn *over* the PDF, and on export the coordinates travel

to a Python backend, which finds the original glyphs under them, deletes them,

and writes the replacement on the same baseline.

Fidelity is the whole point. A replacement inherits the **font, weight, slant,

size and colour of the run it replaces**: the document's own embedded face is

reused whenever it can be embedded and can render the new characters

(`font_source: exact`), otherwise the closest installed family comes in, then a

base-14 approximation — and the report says which one happened, every time.

Because the ink colour comes from the backend's reading of the span rather than

a sampled pixel, the preview and the export agree by construction, and so does

the geometry.

On top of text editing sits a full **markup toolbar**: freehand ink, highlighter,

arrows, rectangles, ellipses, text boxes and images, each with colour, stroke

width, opacity and fill — plus font, size, weight, alignment and italic for text.

The highlighter snaps to the glyph boxes under the sweep instead of drawing a

thin rectangle, and an arrow's filled head is computed in PDF points, so what you

see and what you ship cannot drift apart.

It is deliberately small: **one HTML page and one Python backend** — no build

step, no npm, no database. `pip install -r requirements.txt`, run uvicorn, open

the page. Use it as an internal redaction tool, embed it as the document step of

your own product, or import `pdf_ops.py` and call the whole pipeline as one

function.

What's included

Click and retype

Fidelity by inheritance

Font reuse

A per-change audit

Eight tools

Real direct manipulation

A properties cluster

Get started

1

Download the ZIP

2

Unzip & install

Extract, then run npm install

3

Run it

npm run dev and start shipping

Basic usage

app/route.ts
from pdf_ops import Annotation, Edit, apply_edits
from sample_pdf import build_sample

raw = build_sample()                       # or: open("report.pdf", "rb").read()

edits = [
    Edit(page=0, rect=(60, 60, 297, 85), text="FY27 Operations Review"),
    Edit(page=0, rect=(60, 88, 248, 106), text="Prepared by the Operations Team"),
    Edit(page=0, rect=(60, 396, 400, 412), mode="delete"),
]
markups = [
    Annotation(kind="arrow", page=0, points=((155.5, 584.0), (310.9, 336.6)),
               color=(0.85, 0.17, 0.17), width=2.5),
    Annotation(kind="highlight", page=0, rect=(60, 202, 421, 220),
               color=(1.0, 0.85, 0.2), fill_opacity=0.35),
]

pdf_bytes, report = apply_edits(raw, edits, markups)
open("report-edited.pdf", "wb").write(pdf_bytes)

File structure

pdflab-click-to-edit-pdf-editor-html-python-pymupdf/
PDFLab/
├─ index.html              # the entire editor: pdf.js canvas, text layer,
│                          # markup toolbar, properties panel, export report
├─ app.py                  # FastAPI: upload, resolve, export, in-memory store
├─ pdf_ops.py              # the engine: glyph removal, font reuse, drawing
├─ font_matching.py        # family matching + the installed-font index
├─ sample_pdf.py           # builds the demo document on demand
├─ requirements.txt        # runtime deps (FastAPI, uvicorn, PyMuPDF)
├─ requirements-dev.txt    # pytest + httpx, for the test suite
├─ conftest.py             # puts the project root on sys.path for pytest
├─ LICENSE                 # Wholesaas Commercial License
├─ README.md               # overview, API, limits, the demo recording
├─ docs/
│  └─ quickstart.md        # install, file structure, basic usage, limits
├─ tests/                  # 115 pytest tests
│  ├─ test_pdf_ops.py      #   the engine: glyph removal, artwork survival, rotation
│  ├─ test_api.py          #   every endpoint, limit and error path
│  ├─ test_fonts.py        #   family matching and the font index
│  └─ test_markups.py      #   pixel checks on the rendered markups
└─ demo/                   # the recording, and how to re-record it
├─ pdf-editor-demo.gif  #   the animated demo in the README
├─ pdf-editor-demo.webm #   the same run as video
├─ record.mjs           #   drives Chromium over the DevTools protocol
├─ overlay.js           #   the pointer, click ripples and captions
├─ assemble.py          #   frames → GIF + WebM, plus the verification
├─ hero.html            #   the product hero image (Tailwind CDN)
├─ hero.mjs             #   shoots it, and the two clean app screenshots
├─ pdflab-hero.png      #   the hero image, 2560×1440
├─ screenshots/         #   editor.png, export-report.png — 2560×1600 each
└─ requirements.txt     #   Pillow, for assemble.py

MIT license

Free for personal and commercial use.

Read the license →

PDFLab — Click-to-Edit PDF Editor (HTML + Python · PyMuPDF) is free. Grab it.

A 3 MB ZIP, signed-in download, instant license key. The rest of the library is free too — explore more scripts.

Browse the library

Keep exploring

More free templates & the Pro vault

See all free templates

The Pro vault

You've got the free stuff. Unlock the full vault.

Premium templates — full-stack boilerplates (auth, billing, admin panels) at a fixed one-time price. Pay once, keep the template and your license key forever.

Comments

Questions, feedback and experiences from members who shipped withPDFLab — Click-to-Edit PDF Editor (HTML + Python · PyMuPDF).

Comments are reviewed before they appear — keep it constructive and on-topic.

No comments yet

Be the first to share your experience with this template.

Join the conversation

Sign in to leave a comment on this template.

Sign in to comment