nowfound

Life & fun · January 9, 2025

TI

Tetris in a PDF

I realized that the PDF engines of modern desktop browsers (PDFium and PDF.js) support JavaScript with enough I/O primitives to make a basic game like Tetris. 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. All in all it's quite janky but a nice reminder of how general purpose PDF scripting can be. The linked PDF is all ASCII so you can just open it in a text editor, or have a look at…

Tetris in a PDF launched on January 9, 2025 with 1,289 votes, #2 of 6,142 launches that month and more than 99% of that year's launches. The site was still online in September 2026, 1 year on.

In plain words

Tetris in a PDF is a playable implementation of Tetris built entirely within a PDF file using JavaScript supported by modern browser PDF engines. It works by using annotation fields to create monochrome pixels and a text input box for keyboard controls. The game is fully viewable as ASCII text in any text editor, demonstrating how PDF scripting can support interactive applications despite technical limitations across different PDF engines.

written from the facts on this page · September 2026

From the sources

In the maker’s words, at launch

I realized that the PDF engines of modern desktop browsers (PDFium and PDF.js) support JavaScript with enough I/O primitives to make a basic game like Tetris. 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…

Does a similar job

all alternatives →
  • D1
    Doom (1993) in a PDF2025 · doompdf.pages.dev · ▲369

    I made a Doom source port that runs within a PDF file. I was inspired by the recent HN post about Tetris in a PDF (https://news.ycombinator.com/item?id=42645218) and I wondered if I could get Doom to run using a similar method. It turns out that old versions of Emscripten can compile C to asm.js code that will happily run inside the limited JS runtime of the PDF engine. I used the doomgeneric (https://github.com/ozkl/doomgeneric) fork of the original Doom source, as that made writing the IO fairly easy. All I had to do was implement a framebuffer and…

  • IG
    Interactive guide to Tetris in ClojureScript2014 · shaunlebron.com · ▲157
  • Simple JavaScript Tetris2016 · github.com · ▲112

    Contribute to jstimpfle/tetris-on-a-plane development by creating an account on GitHub.

  • PJ
    Pdf.js Express – PDF annotation, e-signatures, and form filling2020 · ▲334

    Hi HN, Nick here. We're super excited to officially launch PDF.js Express [1]. PDF.js Express wraps a modern React UI around the PDF.js rendering engine to enable PDF annotation, form filling, and signing inside your web app. We've also made some improvements to PDF.js text search, and taken a different approach to how the viewer uses the PDF.js rendering API, resulting in sharp graphics at any zoom magnification [2]. Based on our research, more than 70% of those who try to implement these features on top of PDF.js find it too difficult or time-intensive [3]. For those who are successful,…

  • TB
    Tetris, but the blocks are ARM instructions that execute in the browser2023 · ofrak.com · ▲472

    OFRAK Tetris is a project I started at work about two weeks ago. It's a web-based game that works on desktop and mobile. I made it for my company to bring to events like DEF CON, and to promote our binary analysis and patching framework called OFRAK. In the game, 32-bit, little-endian ARM assembly instructions fall, and you can modify the operands before executing them on a CPU emulator. There are two segments mapped – one for instructions, and one for data (though both have read, write, and execute permissions). Your score is a four byte signed integer stored at the virtual address pointed…

  • TI
    Tetris Implemented in ClojureScript2019 · djblue.github.io · ▲135

More life & fun this month

the category →

Source: Show HN post ↗ · launch text quoted in part

Launched alongside, January 2025

the whole month →
  • Hello! I'm Byran. I spent the past ~6 months engineering a laptop from scratch. It's fully open-source on GH at: https://github.com/Hello9999901/laptop

    Dev tools · 2025 · byran.ee

  • 21st.dev▲1,211

    I originally built this app to organize and reuse interesting React + Tailwind components I came across on Twitter, inspired by the shadcn/ui approach. Later, a friend started contributing their own components, and it got me thinking—this could grow into something bigger, like an NPM for design engineers to share and use components. Would love to hear your thoughts!

    Dev tools · 2025 · 21st.dev

  • Create lifelike, personalized AI avatars from text prompts

    AI · 2025 · jogg.ai

  • Turn Figma designs into full stack apps with AI

    Dev tools · 2025 · figma.com

  • CSS library based on Counter Strike 1.6 UI.

    Life & fun · 2025 · cs16.samke.me

  • Get suggested the best leads to follow-up

    AI · 2025 · folk.app