... DoomPDF. JavaScript in PDFs can support 3D rendering, make HTTP requests, and detect every monitor connected to the user's system. LinuxPDF use a RISC-V emulator forked from TinyEMU.
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.
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,
The project is released under GPL v3 and has been forked 55 times already. The performance can be 100 times slower than what it should since version of V8 that Chrome's PDF engine uses has its JIT compiler disabled.
That is insane!
That is the power of good open source!
Incredible what those guys were able to do in pdf! Frankly, I didn't know PDFs support a form of JS.
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.
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,
Source: https://github.com/ading2210/linuxpdf
The project is released under GPL v3 and has been forked 55 times already. The performance can be 100 times slower than what it should since version of V8 that Chrome's PDF engine uses has its JIT compiler disabled.
GitHub Page
Posted via D.Buzz