Step 20 - export

1 min read

Add exports (canvas menu).

All exports render through the util painters on an offscreen canvas and respect private mode by exporting visibleEls.

  1. PNG: content-cropped bounds of all elements plus 40px padding, opaque background (board color or white), scale capped at 2x with a 2000 px longest-side ceiling. Images must not taint the canvas - they already load with crossOrigin='anonymous'; on a CORS failure retry that image without it and warn.
  2. CSV: dump every note and text element (semicolon-separated: type, text, author, createdAt) for spreadsheet-based synthesis after workshops.
  3. PDF - one page per frame:
    • If the board has frames: sort them in reading order; each frame's padded bounds (roughly x-24, y-40, w+48, h+64 to include the title) becomes one page. No frames: a single content-cropped page.
    • Rasterize each page at up to 2400 px on the longest side, JPEG-encode, and place onto A4 pages (595.28 x 841.89 pt, 24 pt margin) choosing portrait/landscape per page aspect. Use a small PDF writer (hand-rolled object writer or a minimal lib) - no heavyweight dependency.
    • Filename from the board title; show a progress state while rendering.

Acceptance: a 3-frame board exports as a 3-page PDF matching presentation order; a huge board exports a PNG under the pixel cap; CSV opens in a spreadsheet with correct columns.

Discussion

0 comments

No comments yet. Start the discussion.