[HN Gopher] Linux running inside a PDF file via a RISC-V emulator
       ___________________________________________________________________
        
       Linux running inside a PDF file via a RISC-V emulator
        
       Author : shantara
       Score  : 115 points
       Date   : 2025-01-31 21:01 UTC (10 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | ks2048 wrote:
       | Wow. I guess it was just a matter of time after seeing the Doom
       | and Tetris PDFs.
       | 
       | FYI, the PDF is 6.2 MB.
        
       | transfire wrote:
       | That's just wrong.
       | 
       | It's no wonder we have endless security issues when documents
       | that should be just data and metadata (layout) declarations are
       | Turing complete. Sigh.
        
       | hcarvalhoalves wrote:
       | You people really managed to sprinkle JS everywhere, even on PDF.
       | Shame on you.
        
         | siwatanejo wrote:
         | Completely agree lol, why the downvotes?
        
           | jvan wrote:
           | Probably because JavaScript has been part of pdfs since
           | Acrobat 4, way back in the last millennium.
        
       | sedatk wrote:
       | On Edge (Chromium), I get this error message instead:
       | An embedded page at linux.doompdf.dev says       TypeError:
       | Cannot set properties of null (setting 'value')         at
       | Object.0.9657115108887302 (<anonymous>:248:42)         at
       | set_interval_callback (<anonymous>:43:24)         at
       | <anonymous>:1:6
        
       | IgorPartola wrote:
       | So you can run a PDF reader inside it to display a PDF? Honestly
       | I am a little worried someone will come up with some sort of
       | smart DRM based on this.
       | 
       | In seriousness, it's impressive and highlights how awful the PDF
       | format is. Can we have a document format that is less encumbered,
       | more structured, and more accepted as a "real" document yet?
        
       | purplejacket wrote:
       | See? This is _exactly_ why Facebook banned Linux.
        
       | ubj wrote:
       | Now all we need is a PDF reader embedded within a PDF. Bonus
       | points for enabling it to open itself for infinite recursion.
        
       | b1n wrote:
       | 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:
       | 
       | ```lmd
       | 
       | sha256
       | 77ec0f678315f8a207c3501137e1dfc9642b79a9c93e21807df7b5242846c05c
       | 
       | -------------------------------
       | 
       | # Header 1
       | 
       | Paragraph of text about how bloated the PDF format is.
       | 
       | ```
       | 
       | Zip .lmd together with images/videos if required.
        
         | teruakohatu wrote:
         | What is stopping me just unzipping it, altering the file,
         | hashing the file below the header and then zipping it back up?
        
           | GrantMoyer wrote:
           | DMCA and Trademarks
        
       | teruakohatu wrote:
       | 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?
        
         | forgotpwd16 wrote:
         | In Firefox, about:config > pdfjs.enableScripting > false.
        
       | 0xDEAFBEAD wrote:
       | 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.
        
         | zoom6628 wrote:
         | It is allowed by the PDF/A-3 standard which lets you embed data
         | and script into a PDF. And this is used as the archive standard
         | for PDF files sent in electronic invoicing in a number of
         | countries. Basically you get a human readable file containing
         | the data presented and its digitally signed so your data
         | matches the readable presentation.
        
         | magnat wrote:
         | 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
        
           | HeavenFox wrote:
           | NY tax form also generates a barcode from the information you
           | entered to facilitate faster processing
        
         | tomjen3 wrote:
         | 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).
        
       | revskill wrote:
       | Now install the pdf reader and open the pdf inside that os.
        
       ___________________________________________________________________
       (page generated 2025-02-01 08:01 UTC)