sloppdf

A PDF file that asks a language model for a story, over the internet, while you are reading it.

Download the PDF

Open it in Adobe Acrobat or Acrobat Reader. It will not work in Chrome, Firefox, Edge, or Preview — their PDF viewers implement no networking at all.

How it works

PDF files can contain JavaScript. Acrobat gives that JavaScript exactly one way to reach the network: Doc.submitForm(), which posts the form's fields to a URL. The trick is the reply — if the server answers with an application/vnd.fdf document, Acrobat parses it and writes the values straight back into the form's fields. That is the return channel.

  1. You type an optional topic and click Generate.
  2. The PDF posts that topic to a small relay server.
  3. The relay asks the model for a story, and immediately replies with a job number — not the story.
  4. The PDF re-submits every few seconds asking whether that job is done.
  5. When it is, the relay sends the story back as FDF, and the text appears in the page you are looking at.

Why the relay exists

Two reasons, both unavoidable.

The API key. Anyone who opens a PDF can read every byte of it, so a key stored inside the document is a published key. The relay holds it instead.

Acrobat will not wait. Writing a story takes seconds, and Acrobat drops a submitForm connection long before a slow one finishes — the reply is simply lost. So the relay never makes the PDF wait: it hands back a job number in milliseconds and lets the document poll.

Caveats

Acrobat will ask once whether to allow the document to contact the relay. That is its cross-domain check — a PDF opened from your disk has no origin of its own, so every response counts as cross-domain. Choose Allow.

The window freezes for a moment on each poll, because submitForm blocks the interface. The status line counts the seconds so you can tell it is still working.