Top 5 This Week

Related Posts

3 weird things people ran in a PDF file

I don’t know about you, but I only use PDFs to read documents and sign things. Well, it turns out I’m way behind the times because you can use PDFs to run apps. If you’re just as surprised as I am, here are some projects where people got something running inside of a PDF document.

The beginning of something big

Something weird began to brew around the start of 2025. Thomas Rinsma posted a project on X, where they managed to get Tetris running within a PDF document. And if you don’t believe him, he even made the document available to everyone to try.

So, how did they do it? You can check out all of the details on Thomas’s blog, where he discusses how he achieved this feat. Of note is this particular nugget:

…it turns out that both PDFium (Chromium’s PDF reader) and PDF.js (Firefox’s) implement a little bit of scripting support as well. This piqued my interest, as I tend to see them as more modern/static/safe.

Both engines provide a sandboxed JavaScript runtime, which only has access to several PDF-specific APIs. Many APIs that were specced at some point (and even supported by some readers) are not implemented however, likely because they don’t make a lot of (security) sense from the perspective of a web browser. What is implemented, is mostly related to form-validation.

So, there you have it. As long as you open a PDF document within Chrome or Firefox, the extra bit of code added to the environment lets you do stuff like control a game and update the display.

It was an excellent project, and as expected, people appeared in the comments of the original X post and asked when they’ll get Doom running on it. But, of course, Doom is a far more complex game than Tetris, with more moving parts and controls that require handling. There’s no way someone could get Doom working within a PDF.

Related


Quickly save your work with an Arduino-driven retro floppy disk picture frame

If you’re always forgetting to save your work, one day you’ll regret that. This Arduino-driven retro floppy disk will remind you and do it for you.

2

Someone gets Doom working within a PDF

It was inevitable

This is when vk6_ steps in. They saw what the Tetris PDF managed to achieve and took the challenges to port Doom over to the document format, using a lot of what makes the Tetris PDF work to achieve greater things.

The cool thing about importing Doom specifically into a PDF document is that the game was designed without mice in mind. While enabling mouse controls within the game’s settings is possible, you can comfortably play it with just your keyboard. As such, vk6_ used the same keyboard input capture tech used in the Tetris game above to make a fully playable version of Doom.

If you want to give it a try, check out the DoomPDF GitHub page for the source code or visit the DoomPDF document page to play it.

Related


ModRetro Chromatic review: Nostalgia, turned up to 11

Emulating hardware to play original cartridges is my favorite kind of emulation.

1

The guy that got Doom working within a PDF gets Linux into a PDF

Okay, now it’s getting wild

To round things off, vk6_ then ported an entire Linux distro into a PDF document, and it’s totally usable. Granted, it doesn’t have a nice UI, but when you’re using an operating system is running inside of something usually used for contracts and press releases, you can’t really complain.

Here’s how they did it:

C code can be compiled to run within a PDF using an old version of Emscripten that targets asm.js instead of WebAssembly. With this, I can compile a modified version of the TinyEMU RISC-V emulator to asm.js, which can be run within the PDF. For the input and output, I reused the same display code that I used for DoomPDF. It works by using a separate text field for each row of pixels in the screen, whose contents are set to various ASCII characters. For inputs, there is a virtual keyboard implemented with a bunch of buttons, and a text box you can type in to send keystrokes to the VM.

If you want to check it out, be sure to look at the LinuxPDF GitHub page for a link to the document.

Related


5 of the most unique Linux distros you need to try out

Spice up your Linux life with these fun yet highly-functional distributions

PDFs are now more than just a document

With the discovery that PDFs can run code via Chrome or Firefox, people have been having a lot of fun getting stuff running in them. With this tech still being relatively new, who knows what else people will do with them?

#weird #people #ran #PDF #file

source: https://www.xda-developers.com/weird-things-people-ran-pdf-file/

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Popular Articles