Feature request: thumbnails that reflect annotations — a `withAnnotations` option on the thumbnail plugin + annotation-commit `REFRESH_PAGES`

Aperta
#705 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
58/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Tranquilla
Stack tecnologico
typescript
Ambito
frontend

Direzione di ricerca

Start with the thumbnail plugin’s renderThumb path and its configuration surface, then trace the annotation plugin’s commit path and the existing REFRESH_PAGES handling. Verify how withAnnotations and affected pages flow through the render calls and refresh machinery. Done means annotation-bearing thumbnails can be enabled without changing main-view rendering and refresh after annotation commits; use the reported Playwright probe to verify imported and committed ink.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Environment
  • @embedpdf/[email protected] via jsDelivr (also what the @2 tag resolves to today). Chunks read/probed: embedpdf-7TNsu-EA.js, worker-engine-BkD2-rJn.js.
  • Chromium 145 (headless via Playwright) — same behaviour in our production Chrome app.
The gap

Use-case: a document a user is annotating heavily — in our app, "note pages" the user fills with ink. The thumbnail rail rasterizes the served page only, so a page covered in ink is indistinguishable from a truly blank page in the rail. Native PDF apps (e.g. Adobe Acrobat) composite annotation appearance into their page previews, so users expect thumbs to live with their marks.

Two halves to the gap, both verified on 2.14.4:

  1. Thumbnails never show annotations, and there is no knob to enable it. The engine already supports compositing: the renderPage/renderPageRect options accept withAnnotations (and withForms), default false — the worker maps it to the FPDF_ANNOT flag on FPDF_RenderPageBitmapWithMatrix. But the thumbnail plugin's renderThumb passes only {scaleFactor, dpr, rotation}, and the plugin's config surface (width / gap / buffer / labelHeight / autoScroll / …) has no annotations option — so there is no supported way to get annotation-bearing thumbs.

  2. Annotation commits never refresh thumbnails. The refresh machinery exists end-to-end — the REFRESH_PAGES core action makes the thumbnail plugin drop the affected pages from its per-page task cache and emit onRefreshPages, and the rail re-renders those pages — but only the redaction plugin dispatches it. The annotation plugin's commit path does not, so even annotation-bearing thumbs would go stale as the user edits.

We verified the render half works: passing withAnnotations: true on the thumb-sized render call composites both freshly-committed and imported ink correctly (PDFium generates appearance streams in-memory for rendering). So this looks like wiring, not engine work.

The ask
  • A thumbnail-plugin config option (e.g. withAnnotations: true) forwarded to its render calls.
  • Annotation commits dispatching REFRESH_PAGES for the affected pages (possibly gated on the same option).
Design note from probing

Flipping the render plugin's global config default is not a substitute: the main-view tiles share those defaults, and rasterized annotations would double-draw underneath the live DOM annotation layer. The per-plugin / per-call option is the right lever.

Happy to test a candidate implementation — we have a probe script for exactly this flag.

Lingua principale
TypeScript
Stelle
4.5k
Fork
317
Merge medio
10h 16m
PR unite (30g)
174

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di embedpdf/embed-pdf-viewer

Tutte le issue di embedpdf/embed-pdf-viewer

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.