chaloemphong ac91737c63 Initial commit: Loma PDF Editor with Coolify deploy setup
Browser-only PDF editor (React + Vite + pdf-lib + pdf.js + tesseract.js),
plus a multi-stage Dockerfile that builds the SPA and serves it from nginx
on port 80 with a /health endpoint for Coolify.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 10:20:18 +07:00

Loma PDF Editor

A PDF editor that runs entirely in the browser, aiming at Adobe Acrobat Pro's core features. Files never leave the machine (the only network use is OCR language data from the tesseract CDN).

npm install
npm run dev      # http://localhost:5173
npm run build    # static site in dist/

Features

Area What works
Edit Edit existing text lines (font colour/background sampled from the page), lift existing images to move/resize/replace/delete, add text/images, whiteout
Comment Highlight, pen, rectangle, ellipse, line, arrow, text box, sticky note (real PDF /Text annotation), stamps
Sign Draw / type / upload signature (white paper made transparent), saved in localStorage
Forms Fill existing AcroForm fields (text, checkbox, radio, dropdown), create text fields & checkboxes, optional flatten
Pages Drag-reorder thumbnails, rotate, delete, insert blank, merge PDFs, images → pages, extract, split every N (zip), watermark, page numbers
Redact Mark areas or search-and-redact; redacted pages are rasterised on save so the text is really gone
OCR Thai + English via tesseract.js, adds an invisible searchable text layer
Convert PDF → Word, Excel, PNG/JPG (zip), TXT; images → PDF
Language Thai / English UI, toggled from the top bar or start screen; defaults to the browser language and is remembered (src/i18n.ts)
Other Undo/redo, search, zoom, keyboard shortcuts (V/E/T/H/P/N, Ctrl+Z/Y/S/F, Del)

How it works

  • pdfjs-dist renders pages and extracts text/image positions; pdf-lib writes the output.
  • Every edit is an overlay item stored in PDF user space (src/lib/types.ts) and flattened into the PDF on save (src/lib/export.ts); src/lib/contentEdit.ts parses the content stream to delete the original text/image operators under edited areas. Page operations rewrite the PDF bytes immediately; items follow pages via stable page ids.
  • Text is written with Sarabun (Thai + Latin). src/lib/pdflibThaiFix.ts patches pdf-lib so GSUB-substituted Thai glyphs get correct widths and ToUnicode entries (without it Thai shows gaps and tone marks vanish on copy).

Known limits

  • Editing an existing line or image removes the original operators from the page content stream on save. Content inside Form XObjects is only covered (whiteout), not removed. Glyph positions are estimated from font widths, so a run that shares a text operator with neighbouring text can take that neighbour with it.
  • Edited text always uses Sarabun, not the original font.
  • Thai mark positioning uses the font's default glyphs (pdf-lib applies no GPOS).
  • Word/Excel/PowerPoint → PDF needs a server (e.g. LibreOffice); not included.
  • Password-protected PDFs are not supported.

samples/sample.pdf (generated by scripts/make-sample.mjs) is a test file with Thai text, an image, a table and form fields.

S
Description
No description provided
Readme 2.1 MiB
Languages
TypeScript 87.6%
CSS 10.1%
JavaScript 1.8%
HTML 0.3%
Dockerfile 0.2%