Skip to content
PDFGame

No.05  /breakout.pdf

Breakout PDF

Bricks were harmed. Documents too.

breakout.pdf

Play Breakout PDF

Loads the PDF in Chrome's viewer · click inside to focus

LV.01 About

What is Breakout PDF?

Breakout PDF comes from Omar Rizwan's project horrifying-pdf-experiments, the demo that convinced a lot of people that PDFs could be games at all. It's the classic brick-breaker: a paddle, a ball, a wall of bricks, and a document format that was never meant to do any of this.

What makes it remarkable is the mouse control. PDF scripts can't read the cursor position, so the paddle shouldn't be able to follow your mouse. It does anyway, thanks to a trick involving hundreds of invisible, one-point-wide form fields — more on that below.

It was built for Chrome's PDF viewer specifically, so play it on desktop Chrome, Edge or Brave.

LV.02 Play

How to play.

  1. 01Open the page in desktop Chrome (Edge and Brave also use the same engine).
  2. 02Wait for the countdown to finish; the ball launches on its own.
  3. 03Move your mouse left and right across the playfield — the paddle follows.
  4. 04Bounce the ball into the bricks to destroy them. Watch the lives counter in the corner.
  5. 05Click to pause or resume when you need a breather.
LV.03 Internals

How it works.

The playfield is covered with a row of invisible text fields called bands — band0, band1 and so on — each only one PDF point wide and as tall as the play area. Every band has a mouse-enter action that stores its own index as the mouse X position. Move the cursor and you trigger band after band, which is how the script learns where you are.

Rendering uses the same visibility trick as other PDF games: the paddle, ball and bricks are fields whose display property is toggled, and a game loop started with app.setInterval redraws roughly every 15 ms after a countdown driven by app.setTimeOut.

Clicking focuses a field, and the focus action flips a paused flag — a side effect turned into a feature. Rizwan's repository explains the whole technique and is worth reading if you plan to build your own.

LV.04 Tips

Tips.

  • Move the mouse smoothly; the paddle only updates when the cursor enters a new band.
  • Keep the cursor inside the playfield — leave it and the paddle stops listening.
  • Hit the ball with the edge of the paddle to send it at sharper angles toward corner bricks.
  • Pause by clicking if you need to reposition your hand or mouse.
  • If the paddle lags, close heavy tabs; hundreds of fields make this the most demanding game here after Doom.
LV.05 Compatibility

Where it runs.

ViewerStatus
Chrome (desktop)
The game was designed for Chrome's PDFium viewer.
Works
Edge / Brave (desktop)
Same PDFium engine.
Works
Firefox (PDF.js)
No
Safari (macOS)
No
Adobe Acrobat Reader
Untested here.
Partial
iOS Safari / iPhone & iPad
Mobile PDF viewers ignore PDF JavaScript entirely.
No
Android Chrome
Opens PDFs without a script engine, so nothing moves.
No
LV.06 FAQ

Breakout PDF, answered.

Q1How does the paddle follow my mouse in a PDF?

Hundreds of invisible text fields, each one point wide, report when the mouse enters them. The script uses whichever field you entered last as the mouse's X position.

Q2Who made Breakout PDF?

Omar Rizwan (osnr). It's part of his public GitHub repository horrifying-pdf-experiments.

Q3Can I download Breakout PDF?

Yes. Use the download button on this page and open the file in desktop Chrome.

Q4Does it work on mobile or touchscreens?

No. Mobile PDF viewers don't run PDF scripts, and the control trick depends on mouse hover events anyway.

Q5Why does the PDF have more than one page?

The game itself is on the first page — that's the only one you need. Scroll back up if the viewer drifts down.

LV.07 Next

Play another.