Live data from Hacker News

Linux running inside a PDF file via a RISC-V emulator

github.com

31–40 of 43 posts

Re: Linux running inside a PDF file via a RISC-V emulator

#31
post #14

I've invented a replacement for the PDF format. It's called Locked Markdown. `*.lmd`. It provides 98% of the functionality most people use PDFs for, without all the extra bullshit. The Spec: - The most popular Markdown Spec (git flavour?) - At the top of the page place a hash sum of the markdown below a marker on the page. LMD Reader: - Prevents editing the markdown. - Warns user if the hash sum is not valid. Example…

What is stopping me just unzipping it, altering the file, hashing the file below the header and then zipping it back up?

Instead of a hash sum you could use a crypto signature. Makes it even more useful: if someone legitimately alters the file, you could verify who it was. While you're at it, make it a zipped git repository and you have edit history for free

Re: Linux running inside a PDF file via a RISC-V emulator

#34

Is there even a single solid motivating example for why JS in PDF is useful? Can anyone show a real-world application of JS in PDF where it's actually a good fit? I just don't see why PDF would be your file format of choice if you're writing JS.

The form used by the BOIR, (Beneficial Owner Information Report), which was supposed to be mandatory for all businesses in the US, uses some kind of scripting, which I suspect is JS. I had to spin up a Windows machine on Virtual Box to get the right version of Adobe Acrobat to fill it in, as Adobe dropped support for Linux years ago. Why the CFPB didn't just create an SPA or a web form for this is a mystery to me.

The BOIR is an important tool for helping investigate money laundering. Its constitutionally is in doubt, apparently by people who think money laundering is a good thing.

Re: Linux running inside a PDF file via a RISC-V emulator

#37
post #35

This is kind of what NSO Group’s Pegasus did to break out of iPhone sandboxing. They exploited a codec to bootstrap a virtual machine with a custom instruction set.

This is not breaking any sandboxing as far as I understand it. PDFs can contain JavaScript, JavaScript can emulate a processor and a processor can run Linux... but that Linux is not getting outside the boundaries of the PDF viewer.

Re: Linux running inside a PDF file via a RISC-V emulator

#38
post #23

Earlier quoted context omitted.

PDF forms - you can cut down on errors by using JS to enable/disable parts of the form based on users answers (e.g if not married, you are also not filling jointly in a tax form).

Hasn't most of that moved to the web now.

PDFs work offline, and they are designed to represent printable pages, so if the end document has some use on paper, or if you want to allow users to fill it as a document and to do it completely offline, it make sense to use PDF.

Re: Linux running inside a PDF file via a RISC-V emulator

#39
post #14

I've invented a replacement for the PDF format. It's called Locked Markdown. `*.lmd`. It provides 98% of the functionality most people use PDFs for, without all the extra bullshit. The Spec: - The most popular Markdown Spec (git flavour?) - At the top of the page place a hash sum of the markdown below a marker on the page. LMD Reader: - Prevents editing the markdown. - Warns user if the hash sum is not valid. Example…

Does it do vector graphics and custom fonts?

Re: Linux running inside a PDF file via a RISC-V emulator

#40
post #21

Is there even a single solid motivating example for why JS in PDF is useful? Can anyone show a real-world application of JS in PDF where it's actually a good fit? I just don't see why PDF would be your file format of choice if you're writing JS.

We have tax forms available as interactive PDFs, which: * auto-computes formulas * enables and disables whole sections of the document depending of filled values * performs complex validation, beyond checking for required fields and regexp patterns * offers inline help * can be filled, saved and printed completely offline * when printed, looks exactly the same as traditional, paper form * don't require external softw…

Why is this an interactive PDF in the first place?
Post reply on HN