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

Nate Hoffelder

View posts by Nate Hoffelder
Nate Hoffelder is the founder and editor of The Digital Reader. He has been blogging about indie authors since 2010 while learning new tech skills weekly. He fixes author sites, and shares what he learns on The Digital Reader's blog. In his spare time, he fosters dogs for A Forever Home, a local rescue group.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to top