Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Add `scale` option to toPdf({ vectorInk: true }) for preview-size exports

Aperta
#105 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
68/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Tranquilla
Stack tecnologico
typescript
Ambito
api

Direzione di ricerca

Start with ToPdfOptions and the vector-ink path, then compare its handling with the raster toImage({ scale }) path at src/conversion.ts:197. Add coverage for scale, upscale, page dimensions, searchable output, and vector coordinates, then run the relevant tests and add the scale: 2 versus scale: 1 measurement to tests/pdf-vector.bench.ts using the sticker, caligraphy, and turkish fixtures.

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

Descrizione

Follow-up to #101 (see plans/profile-vector-pdf.md).

Context

Profiling #101 showed toPdf({ vectorInk: true }) is not meaningfully slower than the raster path — the dominant cost is the background PNG embed + pdfDoc.save(), both shared with raster; the vector-ink-specific drawSvgPath cost is only 27–148 ms per fixture. So no optimization of the default path is warranted for v0.6.0.

This issue tracks the one piece of #101's step 3 that's a user-facing feature, not an optimization: a scale option for vector-ink PDF previews.

Proposal

ToPdfOptions already has upscale. Add a scale option (positive integer, default 1) that runs the same decodeAtScale / coordinate-shrink path the raster toImage({ scale }) option already uses (src/conversion.ts:197), so a vector-ink preview export of a dense note produces both smaller background geometry and smaller vector geometry — useful for thumbnails, web previews, and anything where a full-resolution vector PDF is overkill.

toPdf(note, { vectorInk: true, scale: 2 }); // half-resolution vector + background

Why it's worth it even though the default path is fine

#101's point 4 names this explicitly. It's a knob, not a default change, so it carries none of the risk the step-3 optimizations (contour simplification, worker parallelism) would — it just lets a caller trade vector fidelity for size when they don't need the crispness vectorInk exists for.

Acceptance criteria

  • toPdf(note, { vectorInk: true, scale: n }) produces a valid, searchable PDF whose page dimensions and vector coordinates are 1/n of the default, for integer n >= 1.
  • Output bytes scale down meaningfully with scale on the dense fixtures (sticker / caligraphy / turkish from #101).
  • Combines with upscale the same way the raster path does.
  • New test + a bench entry in tests/pdf-vector.bench.ts showing the size/time reduction at scale: 2 vs scale: 1.

Non-goals

  • Not changing default behavior (scale defaults to 1).
  • Not contour simplification (separate, not warranted per #101 profile).
Lingua principale
TypeScript
Stelle
42
Fork
9
Merge medio
30m
PR unite (30g)
2

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 philips/supernote-typescript

Tutte le issue di philips/supernote-typescript

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.