You might expect PDF files to only be comprised of static documents, but surprisingly, the PDF file format supports Javascript with its own separate standard library. Modern browsers (Chromium, Firefox) implement this as part of their PDF engines. However, the APIs that are available in the browser are much more limited.
The full specfication for the JS in PDFs was only ever implemented by Adobe Acrobat, and it contains some ridiculous things like the ability to do 3D rendering, make HTTP requests, and detect every monitor connected to the user’s system. However, on Chromium and other browsers, only a tiny subset of this API was ever implemented, due to obvious security concerns. With this, we can do whatever computation we want, just with some very limited IO.
↫ LinuxPDF GitHub page
I’m both impressed and concerned.
Whatever could go wrong?
PostScript was Turing complete so it can do this kind of crazy stuff. PDF was designed to avoid this kind of shit and to make it predictable. Then some genius added full Javascript.
The problem with PostScript was not so much its “full blown language” ability but that code on one page could and would impact what was happening elsewhere. PostScript is all side-effects all the time. As a page-description language, it is a mess.
PostScript needed a “PostScript the Good Parts” moment. Before that really happened, we got PDF.
Can Encapsulated PostScript (aka EPS) alleviate parts of these issues ?
https://en.wikipedia.org/wiki/Encapsulated_PostScript
See… these developers do this type of thing to try and impress recruiters. I personally would never hire such a person. Something like this is a clear demonstration of someone who’s going to want to always do ‘interesting’ side projects and not work on anything that’s actually useful.
Rather than have wasted time building this, perhaps the effort would have been better spent on working on one of the several thousand bugs currently in Wayland’s backlog.
How the whole Linux community isn’t yet already working on it ?
If you look up JSLinux a similar kind of project, I believe that was done by the same person who also created QEMU.
QEMU is now what runs basically all VPS providers and almost all cloud providers except Azure (Amazon, Google, etc. use KVM/QEMU) and it’s the main program used by many (probably most) on Linux to run VMs.
Oh my word, it actually works. Go to linux[dot]doompdf[dot]dev and you’ll see it in action. You can run a lot of your typical linux command line utilities, all inside a PDF inside the chromium pdf viewer. This is very weird. And, like Thom said, it’s a bit disturbing.
Although, the doompdf game at doompdf[dot]dev is way cooler.
For those who haven’t seen it, you should also check out the site: JSLinux
You can run Linux but also Windows 2000 with GUI and even limited networking (it seems to go through a proxy server).