Tetris has been crammed into a tiny 60KB PDF, works in any browser

You May Be Interested In:Victoria’s hot seats LIVE updates: Our on-camera chat with Amelia Hamer in Kooyong; A battle of Wills: NOBS group highlights what’s missing north of Bell Street


WTF?! A clever security analyst has proven that PDFs are not just for boring documents and forms. He’s managed to squeeze the classic Tetris game into a 60KB PDF file that can run right in your browser.

The creation, dubbed “Pdftris” by its maker Thomas Rinsma, lets you play the addictive falling blocks puzzler with just a click. We fired it up on Firefox and sure enough, those tetriminos were tumbling down the makeshift game area like it was 1984 all over again.

For controls, you can use the mouse to click the on-screen buttons, which wasn’t intuitive at all. Thankfully, Rinsma also baked in keyboard controls – players can move, rotate, and drop the tetriminos with the WASD keys.

The game has no sound, no color, and is stuck running in a modest browser window. But we’d argue that this adds to the retro charm. And maybe future updates could introduce these missing pieces.

As for how Rinsma managed to cram all this functionality into a file format intended for documents, it’s made possible using the rarely-explored realm of PDF scripting, supercharged by none other than JavaScript.

PDF engines that power browsers like Chrome and Firefox actually support a limited set of JavaScript commands. Rinsma realized he could exploit this to cobble together a basic game like Tetris from the ground up.

This wasn’t exactly a walk in the park. Rinsma had to figure out hacky workarounds to get his game rendering properly across different PDF engines. His solution was using the show/hide functionality for PDF annotation “fields” to create those iconic monochrome Tetris pixels.

Controlling the action presented another challenge. While you can use the on-screen buttons, Rinsma cleverly enabled keyboard controls by allowing you to type into a text input box below the game. Typing sends keystroke events that the game can interpret into actions.

The result is admittedly pretty “janky” in Rinsma’s own words. But that’s kind of the beauty of experimental stuff like this.

Under the hood, Pdftris is just plain old ASCII text hiding inside that PDF file. You can download it and open the code in a text editor to see how it works. Or you could check out Rinsma’s GitHub repo for some more readable source code with comments.

Now, you might be thinking – if Tetris can run in a PDF, surely someone wouldn’t dare try squeezing something crazy like Doom into one too, right? Well, Rinsma knew you’d have that thought. He reckons it could indeed be possible “with the right tricks” if a single PDF engine is targeted.



share Paylaş facebook pinterest whatsapp x print

Similar Content

NASA delays crewed Artemis missions to 2027 due to faulty heat shield
NASA delays crewed Artemis missions to 2027 due to faulty heat shield
Record-high carbon emissions in 2023 erase gains from pandemic decline
Record-high carbon emissions in 2023 erase gains from pandemic decline
Atari 2600: The Atlantis of Game Consoles
Atari 2600: The Atlantis of Game Consoles
TCL is promising brighter, cheaper, and less power-hungry OLED monitors
TCL is promising brighter, cheaper, and less power-hungry OLED monitors
Snapchat most-used app for online grooming, says NSPCC
Snapchat most-used app for online grooming, says NSPCC
John Carmack and Tim Sweeney defend Microsoft
John Carmack and Tim Sweeney defend Microsoft’s WHAMM AI Quake demo
Flash News Hub | © 2025 | News