DOOM is a classic game to implement on a variety of platforms, but doompdf by [ading2210] is one we didn’t see coming. It runs a bit slow and controls are a little awkward but it does run. Entirely within a PDF file, at that.
How is this possible? PDFs are technically capable of much more than just displaying static content, and support JavaScript with their own library of functions. Adobe Acrobat implements the full spec, but modern web browsers implement at least a subset of the functionality in a sandboxed JavaScript runtime environment. Input and output are limited to things one might expect from a fancy PDF form (text input boxes, clickable buttons, things of that nature) but computation-wise, just about anything goes.
The playable DOOM PDF therefore implements keyboard input by reading characters typed into a text entry box, or has the user click buttons with the mouse. It’s not the smoothest of input methods but it’s gloriously hacky. What’s even better is the video output, which is essentially ASCII-art video frames. Zoom in and you’ll see for yourself! It’s not the fastest frame rate, but it’s fantastic all the same.
![](https://hackaday.com/wp-content/uploads/2025/01/DOOM-pdf-zoom.png)
This project was partly inspired by Tetris in a PDF which demonstrated a lot of the concepts used, and if you like electronic document related shenanigans, be sure to check out playing chess against your printer with PostScript. PostScript is actually a fully functional interpreted language, but unlike JavaScript it was never intended to be used directly by humans.
Thanks to everyone who sent this to our tips line!
ISTR PDF is at it’s core Postscript which is, as the article states, a fully functional interpreted language so it’s not really a surprise that you can port Doom to it but it’s impressive all the same.
PDF explicitly stripped out the turing-complete-ness from Postscript.
Then they added it back with embedded javascript. Oh well.
Oh good grief, so they took a complete interpreted language, crippled it and then added more cruft to uncripple it.
Display Postscript was impressive.
Interestingly, it doesn’t work in Acrobat DC (the site actually says it only works in Chromium based browsers). If it only works in one web browser, and not in Adobe’s own PDF software, does it count as a proper PDF? If it’s fully compliant with the PDF spec, why can’t Acrobat run it?
“it only works in one browser”, isn’t exactly correct as 80-90% of all browsers are Chromium based, ie works in Microsoft Edge, because Edge is just repackaged Chromium.
Shimboot dev going viral for pdf doom? We truly live in the best timeline.
Is this a polyglot yet?
It would be cool to render as vector graphics instead of ascii art. Seems like that would be doable by replacing the rasterizer to output raw polygons.
Reminds me of “badformer” the platformer written for the typesetting language Typst (by the developers of Typst). You type your motion in as text and the output is rendered as a very basic wireframe game.
The rendering occurs in real time, and although it can be rendered to a PDF, the PDF would only be the “display”. Rendering is performed at compilation which is triggered by changing the source document text. As I understand it, rendering to PNG is faster than to PDF.
https://typst.app/universe/package/badformer/
I suppose it would be possible to extend this all the way to a Doom clone. Render times might get too long though.
Next, HyperCard!!!
We have doom inside a PDF before GTA 6