Live data from Hacker News

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

github.com

21–30 of 43 posts

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

#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 software beyond a PDF reader

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

#23

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.

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).

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

#24

When the last Tetris PDF was on the HN homepage I looked into ways of disabling JS in PDFs but was unable to find anyway other than disabling JS for the entire browser. I tried messing about with uBlock filters but to no avail. Does anyone know if this can be achieved?

In Firefox, about:config > pdfjs.enableScripting > false.

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

#25
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…

NY tax form also generates a barcode from the information you entered to facilitate faster processing

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

#26

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.

Same reasons JS in HTML documents is useful??

Frontend form validation. Hide/show widgets, etc

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

#27
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?

not sure, but maybe hashing the media files to be zipped and including that hashlist in the hashed lmd would prevent that? or at least allow for a verification that they werent altered

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

#29
post #23

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.

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.

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

#30
Damn Good stuff, bot the doom and this linux of your! Kudos.

I had done LLM in PDF sometime Nov last year but it wasn't released. Since the doom in pdf uptick, I had released a demo here:

https://x.com/VulcanIgnis/status/1879649889178837025

Actually you don't need an old version of emscripten, hit me up for the Makefile and pdf templates or wait till offical release. My build script will make the pdf work both on chrome and firefox, adobe support is pending.

Post reply on HN