Back to browse
GitHub Repository

A full level 3 PostScript interpreter that renders PS and EPS files to PNG, TIFF, PDF, and SVG

10 starsPython

PostForge – A PostScript interpreter written in Python

by AndyCappDev·Feb 19, 2026·2 points·7 comments

AI Analysis

●●SolidBig BrainCozy

Readable PostScript interpreter alternative to GhostScript, but GhostScript still faster.

Strengths
  • Full Level 2 + selected Level 3 compliance with modular operator architecture; each category in own file
  • Interactive REPL and Qt display window for step-through debugging—rare in PostScript tooling
  • PDF output with Type 1 font reconstruction, TrueType/CID embedding, ICC color profiles, EPS auto-cropping
Weaknesses
  • Python-based, so inherently slower than 35-year-old C codebase (GhostScript); Cython helps but likely still lags
  • Niche use case; most PostScript work delegated to GhostScript, limiting real-world adoption pressure
Target Audience

PostScript developers, print engineers, document processing workflows, education

Similar To

GhostScript · Poppler

Post Description

Hi HN, I built a PostScript interpreter from scratch in Python.

PostForge implements the full PostScript Level 2 specification — operators, graphics model, font system, save/restore VM, the works. It reads .ps and .eps files and outputs PNG, PDF, SVG, or renders to an interactive Qt window.

Why build this? GhostScript is the only real game in town for PostScript interpretation, and it's a 35-year-old C codebase. I wanted something where you could actually read the code, step through execution, and understand what's happening. PostForge is modular and approachable — each operator category lives in its own file, the type system is clean, and there's an interactive prompt where you can poke at the interpreter state.

Some technical highlights:

- Full Level 2 compliance with selected Level 3 features - PDF output with Type 1 font reconstruction/subsetting and TrueType/CID embedding - ICC color management (sRGB, CMYK, Gray profiles via lcms2) - Optional Cython-compiled execution loop (15-40% speedup) - 2,500+ unit tests written in PostScript itself using a custom assertion framework - Interactive executive mode with live Qt display — useful for debugging PS programs

What it's not: A GhostScript replacement for production/printer use. It's interpreted Python, so it's slower. But it handles complex real-world PostScript files well and the output quality is solid.

I'd love feedback, especially from anyone who's worked with PostScript or built language interpreters. The architecture docs are at docs/developer/architecture-overview.md if you want to dig in.

Similar Projects

Developer Tools●●Solid

Fullbleed – Rust HTML/CSS-to-PDF with Deterministic Output+Python CLI

It skips headless Chromium entirely and implements an HTML/CSS-to-PDF pipeline in Rust, exposing a Python wheel and CLI that releases the GIL and uses Rayon for parallel batch renders. The deterministic bits — fixed-point base unit, --repro-record/--repro-check, SHA256 outputs and vendored assets — are a clear, practical play for audited VDP/transactional workflows; what's still unknown is CSS spec coverage and whether subtle print-layout quirks will require hand-holding.

WizardryNiche Gem
krflol
203mo ago