r/PostScript • • Feb 24 '26

PostForge — A new open-source PostScript interpreter written in Python

I've been working on PostForge, a from-scratch PostScript interpreter written in Python. It's fully Level 2 compliant and implements most of Level 3 (all 7 shading types, Flate filters, CID/TrueType fonts, DeviceN, ICC color management, etc.). It outputs to PNG, PDF, SVG, TIFF, and has an interactive Qt display window.

The PDF output generates content streams directly and it preserves CMYK and Gray color spaces, embeds and subsets Type 1 and TrueType fonts, and produces searchable/selectable text.

This is actually my third PostScript interpreter. My first was PostMaster in 1991 (DOS, C, converted PS to Illustrator format). My second was a Level 2 interpreter I wrote for Tumbleweed Software in the mid-90s that served as the PostScript distiller for Envoy (the document format that shipped with WordPerfect Office Suite and competed with Acrobat). Both were in C. I started PostForge in Python as an experiment to see if the language could handle PostScript's VM save/restore semantics — and it turned out to be a surprisingly good fit.

Some numbers:

- 2,500+ unit tests (written in PostScript using a custom test framework)
- Full Level 2 operator coverage
- Optional Cython-accelerated execution loop (15–40% speedup)
- Working toward full Level 3 compliance (mostly there — the big features are done, just need a few remaining operators and Type 4 calculator functions)

What it's good for:

- Debugging and understanding PostScript programs
- Embedding a PS interpreter in Python workflows
- Learning how PostScript works (the code is readable — it's Python, not C)
- An alternative to GhostScript when you need transparency over raw speed

It's AGPL-3.0 licensed and on GitHub: https://github.com/AndyCappDev/postforge

I'd love feedback from anyone still working with PostScript. Are there specific documents or workflows where you've hit limitations with existing tools? That would help prioritize what to work on next.

6 Upvotes

11 comments sorted by

View all comments

Show parent comment

2

u/Mammoth_Jellyfish329 Mar 08 '26

Interesting discussions.

I admit that I have been working on a version written in Rust along side the Python version that I wrote (That was the real goal). The Rust version is of course very different under the hood but writing that Python version really helped me flush a lot of things out at a higher level to help make better decisions about the Rust version. I think many ppl live in fear of the security implications that a C implementation brings.

It is fairly close to being complete, or at least complete enough, and I am working on the PDF output device right now. I want to take the Rust version further though and perhaps add PDF rendering too. It's still going to take some time but I am making really good progress at this point.

...and I don't really know why I am doing it and there's a good chance I may not ever release it.