Home Tetris continues to pack a punch, even in tiny 60K PDF format

Tetris continues to pack a punch, even in tiny 60K PDF format

It is the classic, iconic Tetris, but not as we know it.  

A security analyst has taken the humble PDF and managed to adapt a version of the ever-popular title into a 60KB PDF file that can work on any browser. 

As detailed by Tech Spot, Thomas Rinma is the brains behind this particular operation, dubbing his creation as “Pdftris”.

How does it work? Very simply. All you have to do is click to make the blocks fall into place, just like you did all those times before. Users can click the mouse to command the on-screen buttons, or alternatively, to use keyboard controls – WASD keys – to move, rotate, or drop. 

As you would expect, there are no bells or whistles on this type of Tetris. 

No colors, no sound, and no variety give a new feel to retro, but given the parameters he has worked within, it is still an impressive feat from Rinsma. 

Maybe he will develop Pdftris, but to get to this stage, the analyst deployed the lesser-used capability of PDF scripting, bolstered by JavaScript. 

What is under the hood?

The arduous task of delivering a working game/product was encouraged after Rinsma discovered he could make use of the PDF engines that are essential for browsers like Chrome and Firefox. 

This would be the basis for his achievement.

Many hours and struggles followed as he strived to get the game to render across various PDF engines. He had to adapt and overcome, but the show/hide functionality of PDF annotation provided the breakthrough to build the famous Tetris pixels.

It is an experiment but a job very well done. 

Interested users can take a look under the hood – spoiler, you will encounter the humble ASCII text – by downloading the PDF and viewing the code in an editor, or to visit Rinsma’s GitHub stash for more learning. 

Hopefully, more blocks will fall into place for this clever creator as he continues his innovative, developer journey.

 

Image credit: Via Midjourney

About ReadWrite’s Editorial Process

The ReadWrite Editorial policy involves closely monitoring the gambling and blockchain industries for major developments, new product and brand launches, game releases and other newsworthy events. Editors assign relevant stories to in-house staff writers with expertise in each particular topic area. Before publication, articles go through a rigorous round of editing for accuracy, clarity, and to ensure adherence to ReadWrite's style guidelines.

Graeme Hanna
Freelance Journalist

Graeme Hanna is a full-time, freelance writer with significant experience in online news as well as content writing. Since January 2021, he has contributed as a football and news writer for several mainstream UK titles including The Glasgow Times, Rangers Review, Manchester Evening News, MyLondon, Give Me Sport, and the Belfast News Letter. Graeme has worked across several briefs including news and feature writing in addition to other significant work experience in professional services. Now a contributing news writer at ReadWrite.com, he is involved with pitching relevant content for publication as well as writing engaging tech news stories.