Rendering a 36-page AQA exam PDF sequentially created 36 large canvas
elements, causing memory pressure and keeping pdfStatus='loading' for
60–120s in headless Chrome. Two changes:
1. pdfLoader.ts: reuse a single canvas (reduces peak memory from ~120MB
to ~4MB) and fire onPageReady callback after each page so callers can
stream pages to the canvas as they render.
2. ExamTemplateSetupPage.tsx: use the callback to add each PDF page
shape to the tldraw canvas the moment it renders, making the first
page visible within a few seconds rather than after all pages load.
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>