Skip to content(if available)orjump to list(if available)

Linux Running in a PDF

Linux Running in a PDF

43 comments

·February 6, 2025

rolandog

Does anyone know if running PDFs through the following filter (as in [0]) prevent malicious actors?

    gs \
        -dNOPAUSE \
        -sDEVICE=pdfwrite \
        -sOUTPUTFILE=clean.pdf \
        -dBATCH \
        dirty.pdf

[0]: https://tex.stackexchange.com/a/481609/29430

pletnes

I would really appreciate if someone could put a decent PDF reader, like Sumatra, into a PDF so I could have a portable and good PDF reader on locked down computers.

albert_e

Are you going to open that PDF in Adobe Reader?

If yes, Adobe has this friendly AI assistant forced into your face and overlapping floating toolbar on all sides of your document that you cannot get rid of to get a clean view of the document itself.

So your dream of a simple lightweight clutterfree PDF reader will remain a dream, unfortunately.

pletnes

Most browsers can open PDFs but can’t necessarily search large docs quickly.

yapyap

I mean if he’s searching for a good PDF reader I doubt he’ll be opening it in Adobe Reader

taurknaut

I had assumed it went the way of Adobe Flash many years ago.

null

[deleted]

null

[deleted]

lccerina

Sumatra has also a portable version. Doesn't that work for you?

pletnes

If IT finds an exe file they go bonkers. If they find a PDF, who will even care?

TeMPOraL

Pray Microsoft Defender will be nice enough to not look at the PDF too closely.

null

[deleted]

nialv7

Using JS for this feels like cheating... I wonder if similar things would be possible with PostScript?

ptspts

From the computation point of view, it's possible. PostScript has integer arithmetic operations needed for x86 CPU emulation. It also has mutable byte strings, which are useful as emulated memory.

karel-3d

Finally, I can `rm -rf /` in a PDF.

forgotpwd16

Posted few days ago: https://news.ycombinator.com/item?id=42891937. Repo also provides some explanation/info on how the machinery works.

floating-io

Right below this in my feed:

> Ingesting PDFs and why Gemini 2.0 changes everything

Be afraid.

Be very afraid.

surrTurr

Who the hell keeps making those? First I saw Tetris, now a whole OS. Awesome!

beretguy

Linux in browser existed for a while. And if PDF can run JS then just put "Linux.js" in PDF. JS opens up a whole can of worms.

null

[deleted]

nanna

But is there a Linux PDF editor that runs Linux in a PDF? Evince isn't loading it for me...

alt227

The only place I can get it to run is in Chrome. Wont work in Adobe reader, Firefox, evince etc. Seems most people that do this 'coding in a PDF' only target chrome as a runtime.

Not sure if theres a reason for that like chrome allows more code execution within a document or something?

ddalex

Just because you can, doesn't mean you should....

johannes1234321

Of course one should. One should always explore and satisfy curiosity.

What one shouldn't do is to use any of that for "serious" purpose, but that kind of stuff is apart of what makes computing great - boundaries are in the imagination.

beretguy

Set pdfjs.enableScripting in Firefox about:config to false.

null

[deleted]

afandian

Doesn't work in Evince or Firefox FWIW.

kleiba

It says in the document itself that it only works in Chromium-based browsers.

taurknaut

What kind of pdf feature works in chrome but not evince?

inetknght

The kinds of features that benefit Google and not necessarily the general public.

speerer

Insane ones, like hosting an OS.