From 3df5627b9f164bbbb80fb66544edfd71a4e469cd Mon Sep 17 00:00:00 2001 From: Alpaq92 Date: Tue, 30 Jun 2026 20:44:27 +0200 Subject: [PATCH] feat: add PostScript/EPS support via Riposte + bump deps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Render PostScript and EPS (.ps / .eps / .epsf). Riposte (pure-JS, zero-dep, MIT) interprets each page and rasterizes it to a ; the new PostScriptRenderer drives Riposte's engine and lays pages out as `.postscript-page`, matching the PDF/DjVu/comic paged-canvas model. A per-page try/catch keeps an unsupported operator from sinking the whole document. - New src/renderers/postscript-renderer.js; wired into EXT_MAP (.ps/.eps/.epsf) + RENDERER_LOADERS, dropzone pill + toolbar badge (#880e4f), accept list, CSS - riposte pinned as a git dep (no Vite alias needed — it declares no package exports) - README / CREDITS / EMBEDDING updated (riposte is the 4th git-dep engine) - Bump deps: mammoth 1.8->1.12, pdfjs-dist 6.0.227->6.1.200, vite 8.1.0->8.1.2 Co-Authored-By: Claude Opus 4.8 --- CREDITS.md | 1 + EMBEDDING.md | 2 +- README.md | 13 +++--- index.html | 3 +- package-lock.json | 44 +++++++++++-------- package.json | 7 ++-- src/main.js | 2 + src/renderers/postscript-renderer.js | 63 ++++++++++++++++++++++++++++ src/style.css | 11 +++++ 9 files changed, 119 insertions(+), 27 deletions(-) create mode 100644 src/renderers/postscript-renderer.js diff --git a/CREDITS.md b/CREDITS.md index 140b8e5..2e93e62 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -27,6 +27,7 @@ dependencies** in anything that ships. | [foliate-js](https://github.com/johnfactotum/foliate-js) | MIT | EPUB/MOBI/AZW3/FB2 | | [mhtml-to-html](https://github.com/gildas-lormeau/mhtml-to-html) | MIT | MHTML/`.mht` web archives → HTML | | [CHMate](https://github.com/Alpaq92/CHMate) | MIT | CHM (`.chm`) reading + rendering — pure-JS ITSF container + LZX, no WASM | +| [Riposte](https://github.com/Alpaq92/Riposte) | MIT | PostScript / EPS (`.ps`/`.eps`) interpreter + canvas renderer — pure-JS, zero-dep, no WASM | | [UTIF.js](https://github.com/photopea/UTIF.js) | MIT | TIFF images | | [exifr](https://github.com/MikeKovarik/exifr) | MIT | EXIF/GPS metadata | | [Vite](https://github.com/vitejs/vite) | MIT | build tooling | diff --git a/EMBEDDING.md b/EMBEDDING.md index 33833f2..49db3d9 100644 --- a/EMBEDDING.md +++ b/EMBEDDING.md @@ -148,5 +148,5 @@ theme + inline `style` attributes). No `'unsafe-eval'` is required. - **Formats:** PDF, DjVu, ODF (ODT/ODS/ODP/ODG), RTF, DOC, DOCX, PPTX, XLSX/XLS, CSV/TSV, Markdown, source code, images (+TIFF/EXIF), comic archives (CBZ/CBR/CBT), e-books (EPUB/MOBI/AZW3/FB2), - web archives (MHTML), Compiled HTML Help (CHM), plain text. + web archives (MHTML), Compiled HTML Help (CHM), PostScript/EPS, plain text. - See [CREDITS.md](CREDITS.md) — every bundled engine is permissively licensed. diff --git a/README.md b/README.md index c7f3cb1..31134a5 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # ReaderJS — Universal Document Viewer -A browser-based document viewer that renders **PDF, ODF, RTF, DOC, DOCX, Markdown, plain text, images, comic-book archives, e-books (EPUB/MOBI), web archives (MHTML), and Compiled HTML Help (CHM)** natively in the browser — no server, no upload, no conversion. Everything runs client-side; your files never leave your machine. +A browser-based document viewer that renders **PDF, ODF, RTF, DOC, DOCX, Markdown, plain text, images, comic-book archives, e-books (EPUB/MOBI), web archives (MHTML), Compiled HTML Help (CHM), and PostScript/EPS** natively in the browser — no server, no upload, no conversion. Everything runs client-side; your files never leave your machine. To give it a try without installing anything, visit the [live demo](https://alpaq92.github.io/ReaderJS/). @@ -13,6 +13,7 @@ To give it a try without installing anything, visit the [live demo](https://alpa | Format | Extension(s) | Engine | |--------|-------------|--------| | PDF | `.pdf` | PDF.js (Mozilla) | +| PostScript / EPS | `.ps` `.eps` `.epsf` | Riposte | | DjVu | `.djvu` `.djv` | DejaView | | ODF — Writer, Calc, Impress | `.odt` `.ods` `.odp` `.odg` | JSZip + DOMParser | | Rich Text Format | `.rtf` | RTF.js | @@ -83,6 +84,7 @@ ReaderJS is built on these open-source libraries: | **[foliate-js](https://github.com/johnfactotum/foliate-js)** | John Factotum | EPUB / MOBI / KF8 (AZW3) / FB2 parsing and paginated rendering | | **[mhtml-to-html](https://github.com/gildas-lormeau/mhtml-to-html)** | Gildas Lormeau | MHTML (`.mht` / `.mhtml`) web archives → one self-contained HTML document | | **[CHMate](https://github.com/Alpaq92/CHMate)** | Alpaq92 | Pure-JS Microsoft Compiled HTML Help (`.chm`) reader — ITSF container + LZX decompression + sanitizing topic renderer, no WASM | +| **[Riposte](https://github.com/Alpaq92/Riposte)** | Alpaq92 | Pure-JS PostScript / EPS interpreter and renderer — rasterizes each page to ``, zero runtime deps, no WASM | | **[UTIF.js](https://github.com/photopea/UTIF.js)** | Photopea | TIFF image decoding | | **[exifr](https://github.com/MikeKovarik/exifr)** | Mike Kovarik | EXIF / GPS metadata parsing for images | | **[Vite](https://github.com/vitejs/vite)** | Evan You / Vite contributors | Build tooling and development server | @@ -90,11 +92,12 @@ ReaderJS is built on these open-source libraries: | **[Open-Color](https://github.com/yeun/open-color)** | Heeyeun Jeong | Colour palette for the compare / diff view | Every library above is a normal **npm dependency** — `npm install` is all you -need, no git submodules. The three that aren't published to npm +need, no git submodules. The four that aren't published to npm ([foliate-js](https://github.com/johnfactotum/foliate-js) for e-books, -[DejaView](https://github.com/Alpaq92/dejaview) for DjVu, and -[CHMate](https://github.com/Alpaq92/CHMate) for CHM) are pinned to commits -as git dependencies in `package.json`. Every engine is permissively licensed +[DejaView](https://github.com/Alpaq92/dejaview) for DjVu, +[CHMate](https://github.com/Alpaq92/CHMate) for CHM, and +[Riposte](https://github.com/Alpaq92/Riposte) for PostScript) are pinned to +commits as git dependencies in `package.json`. Every engine is permissively licensed (MIT / BSD / Apache-2.0 / 0BSD). ## Gallery diff --git a/index.html b/index.html index 0abc430..6a0661b 100644 --- a/index.html +++ b/index.html @@ -120,7 +120,7 @@