Skip to content

feat: a PDF previews as its first page, with its page count - #167

Merged
nyxene merged 4 commits into
masterfrom
feat/33-pdf-preview
Oct 28, 2026
Merged

nyxene merged 4 commits into
masterfrom
feat/33-pdf-preview

Conversation

@nyxene

@nyxene nyxene commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

A PDF previews as its first page, with its page count.

  • A file that starts with %PDF- previews as its first page, drawn by macOS sips like the other images that are not PNG, under a caption such as "pdf, page 1 of 12, 612×792, 340 KiB".
  • The page size comes from the file's first /MediaBox, so the 50-megapixel guard applies; a page whose size cannot be read is drawn no larger than 2048 pixels. The count comes from the page tree's root and is left out for a file over 4 MiB, of which only the start is read; sips reads the file itself, so a larger PDF is still shown.
  • sips draws a PDF on nothing, so a page of black text was dark on the dark preview: the page is drawn to a JPEG first, which sips puts on white.
  • The views a preview's header names, and Next view, are lowercase like every other value.
  • tests/fixtures/preview holds a PNG, JPEG, GIF and SVG of one picture, an SVG without a readable size, a huge SVG, a three-page PDF and a too-large PDF page, with what each should show; a test loads them.

Closes #33
Part of #4

🤖 Generated with Claude Code

nyxene and others added 4 commits October 28, 2026 14:15
A file that starts with %PDF- previews as its first page, drawn by macOS sips like the other images
that are not PNG, under the caption "pdf, page 1 of 12, 612×792, 340 KiB". The page size comes from
the file's first /MediaBox, so the 50-megapixel guard applies: sips needs about 0.9 GB for a moment
to draw the largest page PDF allows. A page whose size cannot be read is drawn no larger than 2048
pixels. The count comes from the page tree's root, and is left out for a file over 4 MiB, of which
only the start is read. sips reads the file itself, so a PDF over 4 MiB is still shown.

Closes #33
Part of #4

Co-Authored-By: Claude <noreply@anthropic.com>
… like every other value

Part of #32

Co-Authored-By: Claude <noreply@anthropic.com>
…d of file

sips draws a PDF on nothing, so a page of black text showed dark on the dark preview. The first page
is drawn to a JPEG of the best quality first, which sips puts on white, and converted from there.

tests/fixtures/preview holds a PNG, JPEG, GIF and SVG of one picture, an SVG without a readable size,
a huge SVG, a three-page PDF and a too-large PDF page, with what each should show; a test loads them.

Part of #33

Co-Authored-By: Claude <noreply@anthropic.com>
…t is shown

Part of #33

Co-Authored-By: Claude <noreply@anthropic.com>
@nyxene
nyxene merged commit cb8322d into master Oct 28, 2026
1 check passed
@nyxene
nyxene deleted the feat/33-pdf-preview branch October 28, 2026 13:24
nyxene pushed a commit that referenced this pull request Oct 28, 2026
Release pull request, maintained by release-please. Merging it creates
the tag and a draft GitHub release; then run `scripts/publish-binary.sh
vX.Y.Z` from a terminal to attach the macOS binary and publish the
release.
---


## [0.19.0](v0.18.1...v0.19.0)
(2026-10-28)


### Added

* a PDF previews as its first page, with its page count
([#167](#167))
([cb8322d](cb8322d))
* a tab nobody named shows what runs in it, and a space holds nine tabs
([#168](#168))
([8b9f799](8b9f799))
* an SVG file previews as its picture, and a click in the header shows
its source ([#164](#164))
([9af1131](9af1131))
* review an agent's changes and send it comments on their lines
([#162](#162))
([626797a](626797a))


### Fixed

* every click target shows the hand, the New space path the text cursor,
and a picture goes while a window is open
([#166](#166))
([e2838bd](e2838bd))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

PDF files preview as their first page

1 participant