Ghostboard pixel

Wow! You Can Now Run Linux Inside a PDF

Yes, you read that right.

Other than being a reliable piece of software, Linux has made some really cool things a reality, be it by powering a coffee maker or running Doom on a terminal. Of course, the tinkerers who dedicate their time and resources to innovate are the real MVPs here.

One such tinkerer, vk6_ (aka ading2210/Allen), a high-school student with an affinity for programming, web development, and cybersecurity, has managed to do something very noteworthy.

They successfully managed to run Linux inside a PDF file on a web browser. 🀯

Running Linux Inside A PDF: What's Happening?

0:00
/0:37

Just a short demo of LinuxPDF booting up and the man command being executed.

Building on an earlier project where they got Doom to run in a PDF file, the developer has now released LinuxPDF, that is powered by a modified version of the TinyEMU RISC-V emulator that has been compiled to asm.js using an older version of Emscripten.

By leveraging the PDF format's JavaScript support, they enabled Linux to run within the document, utilizing the limited but functional JavaScript support available in Chromium-based browsers.

In its current state, users can use the virtual keyboard to interact with LinuxPDF, run commands, or send keystrokes to the virtual machine using the text box. Another thing to note is that this uses the same display code as DoomPDF (linked above).

To quote Allen, they define the inner workings of LinuxPDF like this:

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.

Want To Try It Out?

For a quick test run, you can visit the official website that hosts the live demo; just keep in mind that it only works on Chromium-based web browsers. If you want to build it from source, then you should visit GitHub.

Additionally, I highly recommend you read the original Reddit thread for some great community commentary on this project.

Suggested Read πŸ“–

Running Doom on Android 16’s Linux Terminal
Who would’ve thought Doom could run on the upcoming Android 16’s Linux Terminal?
πŸŽ—οΈ
Here's why you should opt for It's FOSS Plus Membership:

- Even the biggest players in the Linux world don't care about desktop Linux users. We do.
- We don't put informational content behind paywall. Your support keeps it open for everyone. Think of it like 'pay it forward'.
- Don't like ads? With the Plus membership, you get an ad-free reading experience.
- When millions of AI-generated content is being published daily, you read and learn from real human Linux users.
- It costs just $2 a month, less than the cost of your favorite burger.

Become a Plus Member today and join over 300 people in supporting our work.

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to It's FOSS News.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.