Skip to main content

Did You Know You Can Play Games in PDF Files?

breakout pdf chromePDFs are now known simply for being the most universal document (fixed layout or not), but as developer Omar Rizwan showed us recently, they are capable of so much more.

While researching Adobe’s PostScript programming language, Rizwan learned that PDFs can support things like audio and video annotations, embedded Flash, and custom math functions (including a Turing-incomplete subset of PostScript).

These features aren’t supported by most of the 3rd-party PDF readers on Windows, Android, or iOS, but here’s something fun: Chrome’s own PDF reader does support "a tiny subset of the enormous Acrobat JavaScript API surface".

Rizwan found that Chrome supports just enough JS in PDFs to run basic games like Breakout, and he made this PDF as a roof of concept. He says the game only works in Chrome, which I can mostly confirm (it didn’t work in either IE or Firefox – or in Play Books).

You can play the game by moving your mouse in the light blue area beneath the green paddle. This controls its movement.

Github via TNW

Similar Articles

No Comments

Write a Comment