Skip to content

Built-in PDF preview with remembered page and zoom #1938

Closed

Description

@currentbits

User outcome

Read a PDF next to a conversation and retain its position when switching threads. Reuse workers and bound cached documents only after the viewer exists and profiling shows a benefit.

Current scope

PDF text extraction exists, but the Files pane has no dedicated PDF reader. The upstream worker bug and reported savings therefore do not directly establish a Solenta regression.

Acceptance criteria

  • Preview supported local/workspace PDFs and preserve document/page/zoom identity through thread switches.
  • Bound document/worker cache ownership and invalidate changed/deleted files.
  • Keep PDF text extraction and unsupported-file fallback; cover large/error documents without freezing the UI.

Verification

Add focused behavior coverage for the changed path, run relevant checks and record any unverified platform/provider behavior. Do not alter real user credentials or settings during tests.

Tracked by #1926. Implementation status is separate from merge status.

Activity

  1. added and removed on Nov 8, 2026
  2. currentbits commented on Nov 11, 2026

    @currentbits
    OwnerAuthor

    Implemented on branch coder/built-in-pdf-preview-with-remembered-pag-8caba6 (3ac88f1d), not merged yet.

    • files:read returns a new pdf kind (32 MB cap, base64 bytes). Text and image previews keep their 1 MB cap. electron/pdf-text.js is unchanged.
    • The Files pane shows PDFs one page at a time with pdf.js, loaded lazily. Controls: previous/next page, zoom steps, fit width, and keyboard keys. Each open preview owns its document and worker, and both are destroyed when the preview closes. There is no shared worker or document cache, because the issue says to add those only after profiling shows a benefit.
    • Thread switches: each thread remembers its open file, and each PDF remembers its page and zoom. This memory is capped at 50 threads with up to 20 PDFs each, and the oldest entries drop first. If a file got shorter, the saved page is clamped to the last page. If a file was deleted, it is forgotten. Files pdf.js can't open show "Could not open this PDF: …".
    • Checks: renderer tests 3194/3194, electron/test/files-pane.test.js 7/7, typecheck, vite build. Real pdf.js rendered a test PDF correctly in Chromium. The module worker loads from file:// under the production CSP in Electron.
    • Not checked: a full packaged-app run, and the web/remote transport with large PDFs. CJK cmaps, standard fonts that aren't embedded, and JPX images will degrade because no cmap/font/wasm assets are shipped.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions