Jump to content
  • Sign Up
×
×
  • Create New...

Pdftris is a Tetris game inside a PDF which runs in any modern PC browser


Recommended Posts

  • Diamond Member

This is the hidden content, please

Pdftris is a Tetris game inside a PDF which runs in any modern PC browser

The classic Tetris game has been

This is the hidden content, please
and dubbed Pdftris. The classic falling blocks puzzler is claimed to be playable in most desktop browsers and, indeed, we successfully loaded and played the game in Firefox on PC simply by clicking the above link. A security analyst named Thomas Rinsma is the brains behind this new PDF-based browser game.

Here’s a working game of Tetris inside a PDF. Even has keyboard controls (by typing WASD in an input box). Plus, upon game-over you can “save” your score by printing the page

This is the hidden content, please
work in most browsers (built for pdfium/PDF.js). pic.
This is the hidden content, please
.com/n4CPcitzz9
This is the hidden content, please

Background details on the project aren’t extensive, as the GitHub project page ReadMe entry is empty. However, Rinsma was

This is the hidden content, please
with users on the Hacker News feed about the development project.

Rinsma indicates that he was inspired to port a game to run in a PDF after he “realized that the PDF engines of modern desktop browsers (

This is the hidden content, please
and
This is the hidden content, please
) support JavaScript with enough I/O primitives to make a basic game like Tetris.”

The security analyst and self-confessed aficionado of “strange loops and weird machines” also explained that it wasn’t that easy to get his Tetris game to run correctly in both engines. However, he discovered that “showing/hiding annotation ‘fields’ works well to make monochrome pixels.” Moreover, if you try the game with the on-screen buttons and would prefer to use keys, then Rinsma made it so that keyboard control can be achieved by typing in a text input box below the game area.

Rinsma humbly admits that his Tetris in PDF code is “quite janky.” However, he suggests it at least serves as a reminder of the power and flexibility of PDF scripting.

(Image credit: Future)

Those interested in prying inside the Pdftris code don’t need specialist or esoteric development tools. Just choose to download the 60KB PDF, and open it in a text editor and you will find the file is “all ASCII.”

There is some source code available, too, with greater readability and comments inserted. You can see that on the aforementioned GitHub project page, specifically

This is the hidden content, please
.

Get Tom’s Hardware’s best news and in-depth reviews, straight to your inbox.

Rinsma noted that Pdftris isn’t working on

This is the hidden content, please
’s Reader “likely because it’s not compliant in several ways.” Other non-browser Pdftris possibilities like Foxit Reader might work, he mused, as he believes it supports the necessary scripting for the gaming action.

It would be great to get some color, shading, and sound in a future release of Pdftris but we don’t know if this project will be developed much further. In some ways, it is basically a proof of concept.

While Pdftris is certainly an eyebrow-raising mashup of the gaming and document rendering worlds, developers have dragged far duller apps into the gaming realm, particularly

This is the hidden content, please
Excel.
This is the hidden content, please
’s spreadsheet can even host a 3D raytracing gaming engine (with the help of VBA).




This is the hidden content, please

#Pdftris #Tetris #game #PDF #runs #modern #browser

This is the hidden content, please

This is the hidden content, please

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Vote for the server

    To vote for this server you must login.

    Jim Carrey Flirting GIF

  • Recently Browsing   0 members

    • No registered users viewing this page.

Important Information

Privacy Notice: We utilize cookies to optimize your browsing experience and analyze website traffic. By consenting, you acknowledge and agree to our Cookie Policy, ensuring your privacy preferences are respected.