Why create a playable version of Tetris within a PDF? 'Why not?'
The pdftris project shows a unique way you can interact with PDF files.
When you think of PDFs, you probably think about work documents, contracts, and static images. The file format is not known as a gaming platform, but that's exactly how one developer decided to use it. Thomas Rinsma, a security analyst, created a fully functional version of Tetris within a PDF file. While I don't think the game, dubbed pdftris, will become a staple for PC gamers, it is an interesting hacker project that shows the capabilities of PDF files when used in a unique way.
You can play Tetris within a PDF by opening this file in a compatible browser. Rinsma notes that Firefox and all Chromium browsers are supported, though I had a better experience in Chrome than within Edge. That's likely due to the fact that Edge uses Adobe Reader, which is "not compliant in several ways," according to Rinsma.
Sadly for mobile gamers, pdftris only works within desktop browsers at the moment.
Here's a working game of Tetris inside a PDF. Even has keyboard controls (by typing WASD in an input box). Plus, upon game-over you can "save" your score by printing the page ;)https://t.co/YrOInaHOUYShould work in most browsers (built for pdfium/PDF.js). pic.twitter.com/n4CPcitzz9January 5, 2025
The game does not exactly run smoothly, which is hardly a surprise. When I loaded pdftris in Edge the framerate of the game was so low I couldn't play it correctly. The game ran better within Chrome but showed some black lines across my screen. But smooth gameplay isn't what a project like pdftris is about.
Getting Tetris within a PDF was a fun project that also presented a challenge to overcome. Both PDFium, Chromium's PDF reader, and PDF.js, Firefox's PDF reader, use different engines.
"It was a bit tricky to find a union of features that work in both engines, but in the end it turns out that showing/hiding annotation "fields" works well to make monochrome pixels, and keyboard input can be achieved by typing in a text input box," explained Rinsma in a post on Hacker News.
Following feedback from users and those interested in the project, Rinsma shared a blog post about the project. There, they answer the first question I imagine many people will ask, "why would you make Tetris within a PDF?" The short answer from Rinsma is "why not?" Inspiration for the project came after Rinsma realized that PDF engines in modern desktop browsers support JavaScript and some I/O primitives.
Get the Windows Central Newsletter
All the latest news, reviews, and guides for Windows and Xbox diehards.
You can also check out the project on GitHub to see the code used to make keystroke-entry within a text field that allows you to control the following blocks within pdftris.
In case you were wondering, yes, a PDF can be used to run Doom. Rinsma managed to get the classic game working within a PDF after some tinkering.
Sean Endicott is a tech journalist at Windows Central, specializing in Windows, Microsoft software, AI, and PCs. He's covered major launches, from Windows 10 and 11 to the rise of AI tools like ChatGPT. Sean's journey began with the Lumia 740, leading to strong ties with app developers. Outside writing, he coaches American football, utilizing Microsoft services to manage his team. He studied broadcast journalism at Nottingham Trent University and is active on X @SeanEndicott_ and Threads @sean_endicott_.