TGViewer
JavaScript JavaScript @javascript · 31K subscribers
Post #1969 7.37K
📄 Play Tetris in a PDF File

I'll let you decide if this one is fun or frightening! Whether or not this will work depends on your PDF reader or browser support, but it works with Chrome and Firefox, at least.

The PDF document format supports embedded JavaScript and this experiment uses it to implement a game of Tetris. The developer, Thomas Rinsma, has used Python to output the PostScript that includes the game's JavaScript. Couple that with the fact many browser PDF renderers are themselves implemented in JavaScript (e.g. PDF.js) and you have a veritable Matryoshka doll of technologies at play here.
  • 🤣 11
  • 👍 6
  • ❤ 2
  • 🤔 2
More from @javascript
  1. Oct 12, 2026Post #3554
  2. Oct 12, 2026CHALLENGE const arr = [1, [2, 3], [4, [5, 6]]]; const a = arr.flat(); const b = arr.flat(I…
  3. Oct 11, 2026Post #3552
  4. Oct 11, 2026CHALLENGE const output = []; output.push(typeof foo); try { output.push(typeof bar); } cat…
  5. Oct 10, 2026Post #3550
  6. Oct 10, 2026CHALLENGE async function main() { const settled = await Promise.allSettled([ Promise.resol…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →