Skip to content

Grab a PDF page as an image - #84

Draft
davior wants to merge 1 commit into
mainfrom
claude/nice-newton-0gg4a7
Draft

davior wants to merge 1 commit into
mainfrom
claude/nice-newton-0gg4a7

Conversation

@davior

@davior davior commented Nov 27, 2026

Copy link
Copy Markdown
Owner

What

A PDF is a document asset, so it can't go in a playlist or over a video in GVC. This renders a page to a picture and files it as an ordinary image, which can.

  • services/pdf_grab.py: pypdfium2 (already a dependency) renders a page to PNG, catalogued via ingest_file as source=pdf_page with parent_asset_id and a new source_page column.
  • POST /api/assets/{id}/grab-page, GET /api/assets/{id}/pages.
  • Assistant: find_pages / read_page look, propose_grab proposes; the render happens only on Apply. search_assets now names a document hit's page.
  • UI: page picker and per-page "Grab as image" on the PDF's Text tab; a card for proposed grabs.
  • Page pictures are kept out of the PDF's Clips list; they survive deleting the PDF and inherit its attribution.

Whole pages only. Cropping to a table is not done; docs/pdf-grabs.md says what is missing.

Deployment

  • Migration b4c7e19a2d58 adds nullable asset.source_page (runs on container start; downgrade drops it).
  • No new dependencies, env vars, or proxy changes.
  • GVC: nothing required. It can call the new endpoint later.
  • Rebuild: docker compose up --build -d (backend and frontend).

Tested

pytest -q (1670 passed), npm test (534 passed), npm run build.


Generated by Claude Code

A PDF is a document asset and cannot go in a playlist or over a video. Rendering a page
to a picture files it as an ordinary image child of the PDF, so it can.

- services/pdf_grab.py renders with pypdfium2 (already a dependency) to PNG and catalogues
  it through ingest_file with source=pdf_page, parent_asset_id and a new source_page column
  (migration b4c7e19a2d58).
- POST /api/assets/{id}/grab-page and GET /api/assets/{id}/pages.
- Assistant: find_pages and read_page look, propose_grab proposes; apply renders only when
  the person presses Apply. search_assets names a document hit's page.
- Frontend: a page picker and per-page "Grab as image" on the PDF's Text tab, and a card
  for proposed grabs.
- Page pictures are left out of the parent's Clips list.

Cropping to a region is not done: docs/pdf-grabs.md says what is missing.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V1geD4QdBtsfb9vwR5W3g2
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.

2 participants