Skip to content

Feature: open PDFs in the preview pane - #59

Merged
DevMando merged 1 commit into
mainfrom
feature/pdf-preview
Sep 8, 2026
Merged

Feature: open PDFs in the preview pane#59
DevMando merged 1 commit into
mainfrom
feature/pdf-preview

Conversation

@DevMando

@DevMando DevMando commented Sep 8, 2026

Copy link
Copy Markdown
Owner

Summary

Selecting a PDF in the file Explorer now opens it in the preview pane, using the browser's own PDF viewer — scroll, zoom, search, print. Previously PDFs were not previewable at all and could only be handed off to another application.

Why this matters

The preview pane already renders web pages through an embedded browser, and that browser ships with a full PDF viewer. Wiring PDFs to it is a single entry in the list of file types the pane handles, so a common document type stops being a dead end in the file tree.

The deliberate limitation

The assistant cannot read PDFs, and this change does not give it that ability.

A PDF is drawn by the browser's viewer. Its text, pages, and form fields never appear in the page structure the assistant inspects. If the assistant were allowed to open one, it would see a page that loaded successfully and contained nothing at all — and would report the document as empty or broken.

That is the same false conclusion this project has already fixed twice: once for embedded forms inside frames, and once for elements hidden behind overlays. So this PR keeps the two paths separate on purpose:

  • The user can open any PDF in the pane and read it.
  • The assistant is refused, and told which file types the preview supports.
  • If the user opens a PDF and then asks about it, the assistant is told plainly that the content is a PDF drawn by the browser viewer, that an empty result is not evidence the document is empty, and that the way to judge it is a screenshot on a model that accepts images.

Screenshot operations stay exempt from that refusal, because an image is exactly the right tool for a PDF.

What this is not

Text extraction. Making a PDF's contents readable to the assistant is a separate and much larger piece of work belonging in the engine's file-reading tools, not in the preview pane. It was considered and deliberately deferred; nothing here blocks it later.

Scope and risk

Low. One file type added to the preview pane's list, and one guard in the page-inspection script. No change to how web previews, screenshots, or any existing tool behaves. Large PDFs stream from the same local host the pane already uses.

Verification

  • 306 Desktop tests pass, including 3 new ones: the assistant is refused before anything reaches the browser, the same call still works for an HTML page, and the PDF guard keeps its screenshot exemption.
  • Build clean, no warnings.

Worth a manual check: open a real PDF from the file tree and confirm the browser viewer appears in the pane. That path needs a live window and a real file, so no test harness here covers it.

PDFs previously fell through to "preview is available for code, text,
configuration, and common image files" and could only be opened in an external
application. WebView2 carries Edge's PDF viewer, so rendering one in the docked
pane costs a single entry in the Explorer's browser-preview set.

The agent's allowlist deliberately does NOT gain .pdf. A PDF's text, pages, and
fields are drawn by that viewer and never reach the DOM, so letting the agent
open one would hand it a page that looks successfully loaded and inspects as
completely empty — the same false "there is nothing here" conclusion an
uninspected frame used to produce.

For the case where the user opens a PDF and then asks about it, DOM operations
now report what the document is instead of returning an empty snapshot, and
point at a screenshot on a vision-capable model. Screenshot support operations
stay exempt, since an image is precisely how a PDF should be judged.
@DevMando
DevMando merged commit 55d1b33 into main Sep 8, 2026
1 check passed
@DevMando
DevMando deleted the feature/pdf-preview branch September 8, 2026 00:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant