Write the print copy, stamped with its provenance. Always write it fresh from the source you just read — an existing -print copy from an earlier request is a stale snapshot, and reusing or only partially updating it ships outdated values to the PDF. The print file path is the source path with -print inserted before the extension — same directory, same basename. If the source is slides/deck.html, write slides/deck-print.html; if the source is web/index.html, write web/index-print.html. Do NOT use the deck title or project name as the filename, and do NOT write to the project root if the source is in a subdirectory — any change in directory depth breaks every relative URL (@font-face src: url(...), <img src>, <link href>, CSS background: url(...)) and the print tab shows missing images and system-font fallbacks.
Stamp the copy's provenance (required whenever the read header shows a version — every arm of this step). Include this tag in the copy's <head>, carrying the version from step 1's read header and the source's project-relative path (for a read header of [File: designs/report.html] [version: v172]):
<meta name="omelette-print-source" content="v172 designs/report.html">
show_pdf_export_dialog REFUSES a copy whose stamp is missing or no longer matches the source's current version — that is what makes a stale copy un-exportable. If it refuses with a stale-copy error, go back to step 1 (re-read the source) and rewrite the copy fresh; never just add or edit the stamp on an existing copy. If the read header shows no [version: ...] token, the project isn't versioned — omit the stamp; the export tool skips the freshness check there.
If the source is already built on <deck-stage> or <doc-page>, the copy is the source plus content-level print rules only. Both components own their print geometry — never add an @page rule or reflow their layout. For <deck-stage> decks, set data-deck-active on every direct-child slide (not just the current one) so [data-deck-active]-keyed entrance styles resolve on every page — each slide is already one page. For <doc-page> documents there is nothing structural to do.
Otherwise, rebuild the content on the doc_page starter. Call copy_starter_component with kind: "doc_page.js" (once per project — the component file persists), then decide the pagination UP FRONT: a FLOWING document (pour the content into <doc-page margin="0.75in"> as one normal HTML flow; the print engine paginates it — the default for reports, memos, letters, long-form), or EXPLICIT pagination (one <section class="page"> child per page — when the user asks for a page count or the design implies one: a one-page resume, a two-sided flier, a certificate, a brochure). If in doubt, ask the user. Keep the design's typography, colors, and imagery intact either way. For FLOWING documents the component pins no paper size — the print engine paginates onto the user's real paper. Explicitly paginated pages print at a FIXED page box with overflow hidden — letter by default (set size="a4" for a clearly metric user), the user's chosen paper when they export — and content that misses the box is clipped, never reflowed: design each page to FILL the page box and fit letter and A4 alike without overlap (no viewport units — they track the window, not the page). orientation="landscape" for landscape sheets. The component owns the sheet, the pagination, and all print geometry — do NOT write your own @page rule, print-CSS reset, page-card divs, hard-coded paper dimensions, or break-after: page fake sheets. In flowing documents use break-before: page only where a section genuinely starts a new chapter; long tables get a <thead> so the header repeats on every page.
A fixed-canvas design (poster, social graphic, infographic) also goes through the doc_page rebuild, with one decision: the page. Print it at its true dimensions — <doc-page width="18in" height="24in" margin="0">, the page IS the design (use explicit width/height ONLY when the user gives or implies a real physical size) — or scale it onto standard paper — <doc-page size="letter" content-width="960px" content-height="1440px"> (size="a4" when the user is clearly metric), where the content lays out at its authored size and the component scales it to fit that sheet's printable area. Scaled-fit is the ONE place a named size still matters: the component must compute the fit against a known sheet (the export dialog re-fits to the user's actual paper choice at print time where available). When the user's intent between the two isn't clear from their request, ask — in plain terms (print it poster-sized, or fit it onto regular paper?) — before exporting. Never hand-scale with your own CSS transforms; the component owns the scaling either way.
In every copy, add the color-adjust rule so backgrounds and colors match the preview — do NOT strip backgrounds from the design:
* { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
Jump animations to their end state. Do NOT use animation: none (that reverts fade-ins to the hidden base). Instead freeze every animation at its final frame and disable transitions:
* { animation-delay: -99s !important; animation-duration: .001s !important;
animation-iteration-count: 1 !important; animation-fill-mode: both !important;
animation-play-state: running !important; transition-duration: 0s !important; }