# Un menu de boulangerie à l'encre blanche sur kraft

> Le blanc opaque comme ton direct sur kraft : du texte blanc sur le carton brun, un fond blanc sous du texte brun et du blanc réservé dans un pavé vert.

- Version HTML: https://postext.dev/fr/cookbook/white-ink-kraft-menu
- Recette Nº 191 · Sortie et intégration · Niveau 3 (Avancé) · Sorties: Canvas, PDF
- Genres: Feuilles volantes et éphémères
- Nécessite postext ≥ 1.85.1, postext-pdf ≥ 1.85.1 · testée avec 1.85.1, postext-pdf 1.85.1 le 2026-11-13
- Pages: [1](https://postext.dev/cookbook/white-ink-kraft-menu/en/p01.webp?v=137c1047), [2](https://postext.dev/cookbook/white-ink-kraft-menu/en/p02.webp?v=137c1047), [3](https://postext.dev/cookbook/white-ink-kraft-menu/en/p03.webp?v=137c1047), [4](https://postext.dev/cookbook/white-ink-kraft-menu/en/p04.webp?v=137c1047)
- PDF: https://postext.dev/cookbook/white-ink-kraft-menu/en/white-ink-kraft-menu.pdf?v=137c1047
- Ouvrir dans le Sandbox: https://postext.dev/fr/sandbox#recipe=white-ink-kraft-menu&lang=en (.postext: https://postext.dev/cookbook/white-ink-kraft-menu/en/white-ink-kraft-menu.postext)
- Dernière mise à jour: 2026-11-13
- Autres langues: [en](https://postext.dev/en/cookbook/white-ink-kraft-menu.md), [es](https://postext.dev/es/cookbook/white-ink-kraft-menu.md), [ca](https://postext.dev/ca/cookbook/white-ink-kraft-menu.md), [de](https://postext.dev/de/cookbook/white-ink-kraft-menu.md), [it](https://postext.dev/it/cookbook/white-ink-kraft-menu.md), [pt](https://postext.dev/pt/cookbook/white-ink-kraft-menu.md), [zh](https://postext.dev/zh/cookbook/white-ink-kraft-menu.md), [ja](https://postext.dev/ja/cookbook/white-ink-kraft-menu.md), [ar](https://postext.dev/ar/cookbook/white-ink-kraft-menu.md)

## En bref

Le menu d'une boulangerie imprimé sur du carton kraft brun. Le nom et les titres sont à l'encre blanche, que l'imprimeur ajoute comme une encre de plus. Le fichier garde le blanc sur sa propre plaque.

## Ce que vous allez composer

Le menu d'Horno Alto, une boulangerie de village inventée : une carte A5 en kraft brun pliée une fois, quatre pages. Le kraft ne contient pas de blanc, donc chaque blanc de la carte est une encre que l'imprimeur ajoute : le nom et les titres de rubrique directement sur le brun, les passe-partout où se posent les trois gouaches et la carte des horaires. Les prix s'alignent sur une tabulation avec des points de conduite, dans un brun foncé en quadrichromie. Sur la page du café, un pavé vert porte la fournée du jour en texte blanc découpé dans le vert. Folio ouvre la carte sur un comptoir en chêne, à la lumière du jour.

**Cette recette répond à:**

- Comment imprimer du blanc sur papier kraft, en texte et sous les couleurs ?

## La réponse courte

```js
// script.js, lignes 20–35
// The paper is a colour that prints no ink: the screen and Folio paint kraft, and no plate
// gets a dot of it. Because it is not white, the preflight knows the white ink shows on it.
// The white is a spot ink with the white finish: its own plate, laid down before the others.
const kraft = { hex: '#c19a6b', model: 'cmyk', cmyk: { c: 0, m: 0, y: 0, k: 0 } };
const WHITE = { name: 'Opaque White', cmyk: { c: 0, m: 0, y: 0, k: 0 } };
// A white ink overprints by default: laid under the colours, it must not cut holes in them.
const white = { hex: '#f7f4ee', model: 'spot', spot: { ...WHITE, finish: { kind: 'white' } } };
const PRINT = { standard: 'pdfx4', outputProfile: 'fogra52', convertImages: false,
  inks: [{ name: 'Opaque White', aliases: ['White'], finish: { kind: 'white' } }] };

// White type on a green panel must knock the green out.
// White printed under the green is hidden by it. For white type on a colour, the type must cut
// its shape out of the colour, so this white says overprint: false. Its hex differs by one
// step from the other white, since the PDF tells colours apart by hex; both print on one plate.
const whiteOut = { hex: '#f6f3ed', model: 'spot',
  spot: { ...WHITE, finish: { kind: 'white' }, overprint: false } };
```

## Ingrédients

**Enseigne**

- [Encres spéciales](https://postext.dev/fr/docs/special-inks-die-cuts.md#finitions): Un ton direct doté d’une finition : métallisé, dorure à chaud, fluorescent, blanc couvrant ou vernis. Il sort sur une plaque à lui, le canvas peut en montrer le brillant ou une carte des finitions, et Folio l’éclaire.
- [Tons directs et table des encres](https://postext.dev/fr/docs/configuration-pdf-output.md#tons-directs): Une couleur de modèle 'spot' s’imprime sur sa propre plaque, à son pourcentage. La table des encres nomme la plaque comme l’imprimeur la connaît et y réunit les autres noms que la palette, les SVG et les fichiers importés donnent à la même encre.

**Utilise aussi**

- [PDF en CMJN et en niveaux de gris](https://postext.dev/fr/docs/configuration-fonts-colors-viewers.md#génération-pdf-configuration)
- [Visionneuse de livre en 3D (Folio)](https://postext.dev/fr/docs/configuration-html-folio-epub.md#un-livre-en-3d-postext-folio)
- [Papier, reliure, bureau et lumière (Folio)](https://postext.dev/fr/docs/configuration-fonts-colors-viewers.md#visionneuse-folio-configuration)
- [Palette de couleurs sémantique](https://postext.dev/fr/docs/configuration-fonts-colors-viewers.md#palette-de-couleurs)
- [Couvertures, pages de titre et colophons](https://postext.dev/fr/docs/configuration-styles.md#styles-de-titre)
- [Styles de titre](https://postext.dev/fr/docs/configuration-styles.md#styles-de-titre)
- [Texte, filets et boîtes dans les maquettes de page](https://postext.dev/fr/docs/configuration-headers-footers.md#en-têtes-et-pieds-de-page)
- [Images dans les maquettes de page](https://postext.dev/fr/docs/configuration-headers-footers.md#éléments-image)
- [Styles de paragraphe](https://postext.dev/fr/docs/configuration-styles.md#styles-de-paragraphe)
- [Taquets de tabulation et points de conduite](https://postext.dev/fr/docs/configuration-text.md#taquets-de-tabulation)
- [Encadrés](https://postext.dev/fr/docs/configuration-callouts.md#styles-dencadré)
- [Export PDF](https://postext.dev/fr/docs/configuration-pdf-output.md#générer-des-pdf)
- [Pages sur un canvas](https://postext.dev/fr/docs/configuration-programmatic-usage.md#rendre-une-page-en-bitmap)
- [Attributs de titre](https://postext.dev/fr/docs/document-format.md#attributs-de-titre)
- [Bandeau de chapitre sur toute la largeur](https://postext.dev/fr/docs/configuration-headings.md#étendue-et-maquette-avancée)
- [Ouvertures composées](https://postext.dev/fr/docs/configuration-headings.md#étendue-et-maquette-avancée)
- [Couleur du papier](https://postext.dev/fr/docs/configuration-page-layout.md#page)
- [Polices intégrées au PDF](https://postext.dev/fr/docs/configuration-pdf-output.md#pourquoi-un-fournisseur-de-polices)
- [Types de ressource personnalisés](https://postext.dev/fr/docs/configuration-resources.md#types-de-ressources)
- [Figures et tableaux comme ressources](https://postext.dev/fr/docs/document-format-resources.md#ressources)
- [Titres courants par section](https://postext.dev/fr/docs/configuration-styles.md#styles-de-titre)
- [Chapitres non numérotés](https://postext.dev/fr/docs/configuration-styles.md#styles-de-titre)

**La configuration en un coup d’œil**

- [`bodyText`](https://postext.dev/fr/docs/configuration-text.md#texte-courant), [`calloutStyles`](https://postext.dev/fr/docs/configuration-callouts.md#styles-dencadré), [`colorPalette`](https://postext.dev/fr/docs/configuration-fonts-colors-viewers.md#palette-de-couleurs), [`folio`](https://postext.dev/fr/docs/configuration-html-folio-epub.md#apparence), [`footer`](https://postext.dev/fr/docs/configuration-headers-footers.md#en-têtes-et-pieds-de-page), [`header`](https://postext.dev/fr/docs/configuration-headers-footers.md#en-têtes-et-pieds-de-page), [`headingStyles`](https://postext.dev/fr/docs/configuration-styles.md#styles-de-titre), [`headings`](https://postext.dev/fr/docs/configuration-headings.md#titres), [`layout`](https://postext.dev/fr/docs/configuration-page-layout.md#mise-en-page), [`locale`](https://postext.dev/fr/docs/configuration-language.md#césure), [`page`](https://postext.dev/fr/docs/configuration-page-layout.md#page), [`paragraphStyles`](https://postext.dev/fr/docs/configuration-styles.md#styles-de-paragraphe), [`print`](https://postext.dev/fr/docs/configuration-fonts-colors-viewers.md#production-pour-limpression-configuration), [`resourceTypes`](https://postext.dev/fr/docs/configuration-resources.md#types-de-ressources)

**API**

- [`buildDocumentWithFonts`](https://postext.dev/fr/docs/configuration-programmatic-usage.md#charger-les-polices-avant-la-mise-en-page), [`createFolioFromDocument`](https://postext.dev/fr/docs/configuration-html-folio-epub.md#un-livre-en-3d-postext-folio), [`decompressWoff2`](https://postext.dev/fr/docs/configuration-pdf-output.md#fournisseur-de-polices-dans-le-navigateur-fontsource--woff2), `preflightDocument`, [`registerResourceImage`](https://postext.dev/fr/docs/architecture.md#surface-de-lapi), [`renderPageToCanvas`](https://postext.dev/fr/docs/configuration-programmatic-usage.md#rendre-une-page-en-bitmap), [`renderToPdf`](https://postext.dev/fr/docs/configuration-pdf-output.md#générer-des-pdf)

**Caractères**

- Alfa Slab One (OFL-1.1), Lora (OFL-1.1)

## Préparation

### 1 · Le papier est du kraft, le blanc est une encre

Le code est dans [la réponse courte](https://postext.dev/fr/cookbook/white-ink-kraft-menu.md#la-réponse-courte) plus haut. Le papier est une couleur de la palette définie en CMJN à 0 % : l'écran et Folio peignent le kraft, et aucune plaque ne l'imprime. Le blanc est un ton direct avec la finition blanche ([finitions](https://postext.dev/fr/docs/special-inks-die-cuts.md#finitions)), nommé `Opaque White` dans la table des encres, comme on l'indiquera à l'imprimeur. Le fichier PDF/X-4 le place sur une `Separation` à lui, à côté des quatre plaques de quadrichromie. Son hex d'écran est un cran sous `#ffffff`, pour que le masque des finitions distingue l'encre d'une feuille blanche.

### 2 · Le blanc directement sur le brun

```js
// script.js, lignes 63–70
// The mount is a box in the white, the painting a picture over it. The white goes down first
// on press and runs on under the whole painting, so its light tones print on white.
const mount = (x, y, w, h, extra) => [
  { kind: 'box', id: 'mount', style: { backgroundColor: col('white') },
    placement: at('page', 'top-left', x, y, { width: mm(w), height: mm(h) }) },
  { kind: 'image', id: 'photo', resourceId: '{attr.photo}', fit: 'cover', ...extra,
    placement: at('page', 'top-left', x + 4, y + 4, { width: mm(w - 8), height: mm(h - 8) }) },
];
```

Le nom, les titres de rubrique et ceux des pages intérieures sont du texte dans le blanc, composé en Alfa Slab One. Une encre blanche couvre moins qu'un noir : le brun transparaît dans un trait fin, donc une égyptienne grasse de 12 pt ou plus se lit là où un romain léger virerait au beige. Les passe-partout sont des blocs du même blanc, 4 mm plus grands que chaque peinture de tous les côtés. Le blanc continue sous toute la peinture, pas seulement autour : ses tons clairs s'impriment sur du blanc et non sur le brun.

### 3 · La couleur sur le blanc

Les horaires sont posés sur une carte d'encre blanche, dans le brun foncé du texte du menu. Une encre blanche est en surimpression par défaut, et le brun l'est aussi (`overprint: true` sur la couleur de la palette) : sur la presse, le brun se pose sur le blanc au lieu d'y découper ses lettres.

### 4 · Le blanc sur la couleur : le réserver

```js
// script.js, lignes 114–126
const calloutStyles = [
  { id: 'bake', background: col('green'), marginTop: pt(LEAD), marginBottom: pt(0),
    padding: { top: mm(4), right: mm(5), bottom: mm(4), left: mm(5) },
    body: { fontFamily: SERIF, fontSize: pt(BODY), lineHeight: pt(LEAD), color: col('whiteOut'),
      boldColor: col('whiteOut'), italicColor: col('whiteOut'), textAlign: 'left',
      firstLineIndent: pt(0) } },
  // The hours: brown type on a card of white ink, the colour printed over the white.
  { id: 'hours', background: col('white'), marginTop: pt(LEAD), marginBottom: pt(0),
    padding: { top: mm(4), right: mm(5), bottom: mm(4), left: mm(5) },
    body: { fontFamily: SERIF, fontSize: pt(BODY), lineHeight: pt(LEAD), color: col('ink'),
      boldColor: col('ink'), textAlign: 'left', firstLineIndent: pt(0),
      tabStops: [{ position: 'end', align: 'end' }] } },
];
```

La presse pose d'abord le blanc, puis les couleurs par-dessus, donc un texte blanc sur le pavé vert disparaîtrait sous le vert. Le texte du pavé prend un second blanc sur la même plaque, avec `overprint: false` : le texte découpe sa forme dans le vert et le blanc la remplit. Les deux blancs diffèrent d'un cran d'hex, car le PDF distingue les couleurs par leur hex.

### 5 · Les prix sur une tabulation

```js
// script.js, lignes 106–110
const dish = { id: 'dish', name: 'Dish', textAlign: 'left',
  tabStops: [{ position: 'end', align: 'end', leader: '. ' }],
  spaceBetween: pt(LEAD / 3), marginTop: pt(LEAD / 2) };
// The story on the back: half a line between paragraphs.
const story = { id: 'story', name: 'Story', spaceBetween: pt(LEAD / 2) };
```

Chaque rubrique est un groupe `:::paragraphs` dans le style des plats ; `:tab` avant le prix l'envoie au bout de la justification, avec des points de conduite jusqu'à lui, comme dans [le menu de bistrot](https://postext.dev/fr/cookbook/bistro-menu.md).

### 6 · Ce que dit le contrôle avant impression

```js
// script.js, lignes 274–282
// A white ink on white paper prints nothing you can see, and the preflight warns of it
// (whiteInkOnWhite). On kraft it does not fire; the findings left say which special ink the
// job carries and that the press lays the white first.
const findings = preflightDocument(doc);
const report = document.createElement('p');
report.textContent = `Preflight: ${findings.map((f) => f.kind === 'inkPressOrder'
  ? `inkPressOrder (first: ${f.first.join(', ')})` : `${f.kind}${f.ink ? ` (${f.ink})` : ''}`)
  .join('; ') || 'no findings'}`;
document.querySelector(`[data-postext-pdf="${RECIPE}.pdf"]`).after(report);
```

`preflightDocument` avertit avec `whiteInkOnWhite` quand une encre blanche tombe sur une page dont le papier est blanc ou non défini, où elle ne montre rien. Sur kraft il se tait, et la ligne sous le bouton de téléchargement liste ce qui reste : le blanc comme encre spéciale (`spotInkFinish`) et l'ordre de passage qui l'imprime en premier (`inkPressOrder`).

### 7 · Folio montre la carte sur un comptoir

```js
// script.js, lignes 130–136
const folio = {
  tilt: 20, yaw: -12,
  paper: { type: 'cardStock', grammage: 250, texture: 'felt', shade: kraft },
  binding: { type: 'folded', cover: 'pages' },
  surface: { type: 'oak' },
  lighting: { environment: 'daylight', intensity: 1.1 },
};
```

Folio peint le blanc de façon qu'il couvre la teinte du papier, comme le fait l'encre, et le carton à texture feutrée fait passer le brun pour du kraft.

## La recette complète

Un seul fichier, composé à partir du dossier de la recette avec le texte d’exemple et le kit commun des Recettes déjà inclus ; il construit sa propre page. Pour l’exécuter, placez-le dans un `<script type="module">` d’une page vide ou collez-le dans le panneau JS d’un nouveau pen CodePen (en tant que module). Il importe postext depuis esm.sh : il n’y a rien à installer ni à compiler.

- Dossier de la recette: https://github.com/drnachio/postext/tree/main/cookbook/white-ink-kraft-menu

### script.js

```js
// ═══ Postext Cookbook · Nº 191 · A bakery menu in white ink on kraft ═════════════════════
// https://postext.dev/en/cookbook/white-ink-kraft-menu
// Code: MIT · Text: original (CC BY 4.0) · Paintings: diffusion models
// Fonts: Alfa Slab One, Lora (SIL OFL 1.1) · Needs postext ≥ 1.85.1
//
// The menu of a bakery, a folded card of brown kraft. Kraft takes no white from the paper, so
// the name and the course heads print in an opaque white ink, and the paintings sit on white
// mounts that the same ink lays under them; the menu text is a dark brown in process colour.
import {
  buildDocumentWithFonts, renderPageToCanvas, registerResourceImage, preflightDocument,
} from 'https://esm.sh/postext';
import { renderToPdf, decompressWoff2 } from 'https://esm.sh/postext-pdf';
import { createFolioFromDocument } from 'https://esm.sh/postext-folio';

const LANG = 'en'; // @lang: the language of the sample document ('en' | 'es')
const RECIPE = 'white-ink-kraft-menu';

// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region answer: kraft as the paper, and an opaque white as a spot ink
// The paper is a colour that prints no ink: the screen and Folio paint kraft, and no plate
// gets a dot of it. Because it is not white, the preflight knows the white ink shows on it.
// The white is a spot ink with the white finish: its own plate, laid down before the others.
const kraft = { hex: '#c19a6b', model: 'cmyk', cmyk: { c: 0, m: 0, y: 0, k: 0 } };
const WHITE = { name: 'Opaque White', cmyk: { c: 0, m: 0, y: 0, k: 0 } };
// A white ink overprints by default: laid under the colours, it must not cut holes in them.
const white = { hex: '#f7f4ee', model: 'spot', spot: { ...WHITE, finish: { kind: 'white' } } };
const PRINT = { standard: 'pdfx4', outputProfile: 'fogra52', convertImages: false,
  inks: [{ name: 'Opaque White', aliases: ['White'], finish: { kind: 'white' } }] };

// White type on a green panel must knock the green out.
// White printed under the green is hidden by it. For white type on a colour, the type must cut
// its shape out of the colour, so this white says overprint: false. Its hex differs by one
// step from the other white, since the PDF tells colours apart by hex; both print on one plate.
const whiteOut = { hex: '#f6f3ed', model: 'spot',
  spot: { ...WHITE, finish: { kind: 'white' }, overprint: false } };
// #endregion

const palette = {
  kraft, white, whiteOut,
  // The brown overprints: on the white card it lands on the white instead of cutting it away.
  ink: { hex: '#3b2a1c', model: 'cmyk', cmyk: { c: 0, m: 45, y: 75, k: 82 }, overprint: true },
  green: { hex: '#2f5a43', model: 'cmyk', cmyk: { c: 80, m: 25, y: 75, k: 40 } }, // the panel
};
const col = (id) => ({ ...palette[id], paletteId: id });
const colorPalette = [...Object.entries(palette).map(([id, value]) => ({ id, name: id, value })),
  { id: 'main-color', name: 'ink (defaults)', value: palette.ink }];

const [TRIM_W, TRIM_H] = [148, 210]; // A5, an A4 card folded once
const MARGIN = 13;
const MEASURE = TRIM_W - 2 * MARGIN;
const [BODY, LEAD] = [9.6, 13.2]; // pt
const [DISPLAY, SERIF] = ['Alfa Slab One', 'Lora'];
const at = (to, edge, x = 0, y = 0, size) => ({ anchor: { to, edge },
  offset: { x: mm(x), y: mm(y) }, ...(size && { size }) });
const text = (id, content, look, placement) => ({ kind: 'text', id, content, align: 'left',
  overflow: 'wrap', placement, ...look });
const label = (size, color) => ({ fontFamily: SERIF, fontWeight: 700, fontSize: pt(size),
  letterSpacing: pt(size * 0.14), textTransform: 'uppercase', color });
const bare = { numbered: false, toc: false, span: 'page', header: { elements: [] },
  footer: { elements: [] } };

// #region mount: a painting on a white mount, 4 mm of white round it
// The mount is a box in the white, the painting a picture over it. The white goes down first
// on press and runs on under the whole painting, so its light tones print on white.
const mount = (x, y, w, h, extra) => [
  { kind: 'box', id: 'mount', style: { backgroundColor: col('white') },
    placement: at('page', 'top-left', x, y, { width: mm(w), height: mm(h) }) },
  { kind: 'image', id: 'photo', resourceId: '{attr.photo}', fit: 'cover', ...extra,
    placement: at('page', 'top-left', x + 4, y + 4, { width: mm(w - 8), height: mm(h - 8) }) },
];
// #endregion

// The cover: the name in white straight on the kraft, the loaf on its mount.
const cover = { ...bare, id: 'cover', advancedDesign: { enabled: true, minHeight: mm(170),
  slot: { elements: [
    text('title', '{titleText}', { fontFamily: DISPLAY, fontSize: pt(50), lineHeight: 0.9,
      textTransform: 'uppercase', align: 'center', color: col('white') },
    at('page', 'top-left', MARGIN, 22, { width: mm(MEASURE) })),
    text('since', '{attr.since}', { ...label(8, col('ink')), align: 'center' },
      at('#title', 'below', 0, 3, { width: mm(MEASURE) })),
    ...mount(26, 64, 96, 96),
    text('address', '{attr.address}', { fontFamily: SERIF, italic: true,
      fontSize: pt(10), lineHeight: 1.35, color: col('ink'), align: 'center' },
    at('page', 'top-left', MARGIN, 172, { width: mm(MEASURE) })),
  ] } } };

// The inside pages open on a painting across the measure, the kicker and the title in white.
const opener = (id, height) => ({ ...bare, id, advancedDesign: { enabled: true,
  minHeight: mm(height + 20), slot: { elements: [
    ...mount(MARGIN, 14, MEASURE, height),
    text('kicker', '{attr.kicker}', label(7.5, col('ink')),
      at('page', 'top-left', MARGIN, 18 + height)),
    text('title', '{titleText}', { fontFamily: DISPLAY, fontSize: pt(24), lineHeight: 1,
      textTransform: 'uppercase', color: col('white') },
    at('#kicker', 'below', 0, 1.5, { width: mm(MEASURE) })),
  ] } } });

// The back: the bakery's story in brown, the hours on a white card.
const back = { ...bare, id: 'back', advancedDesign: { enabled: true, minHeight: mm(14),
  slot: { elements: [
    text('title', '{titleText}', { fontFamily: DISPLAY, fontSize: pt(24), lineHeight: 1,
      textTransform: 'uppercase', color: col('white') }, at('container', 'top-left')),
  ] } } };

// #region dishes: a dish and its price on a tab stop, dotted to the right margin
const dish = { id: 'dish', name: 'Dish', textAlign: 'left',
  tabStops: [{ position: 'end', align: 'end', leader: '. ' }],
  spaceBetween: pt(LEAD / 3), marginTop: pt(LEAD / 2) };
// The story on the back: half a line between paragraphs.
const story = { id: 'story', name: 'Story', spaceBetween: pt(LEAD / 2) };
// #endregion

// #region panel: the day's bake on green, its type knocked out in white
const calloutStyles = [
  { id: 'bake', background: col('green'), marginTop: pt(LEAD), marginBottom: pt(0),
    padding: { top: mm(4), right: mm(5), bottom: mm(4), left: mm(5) },
    body: { fontFamily: SERIF, fontSize: pt(BODY), lineHeight: pt(LEAD), color: col('whiteOut'),
      boldColor: col('whiteOut'), italicColor: col('whiteOut'), textAlign: 'left',
      firstLineIndent: pt(0) } },
  // The hours: brown type on a card of white ink, the colour printed over the white.
  { id: 'hours', background: col('white'), marginTop: pt(LEAD), marginBottom: pt(0),
    padding: { top: mm(4), right: mm(5), bottom: mm(4), left: mm(5) },
    body: { fontFamily: SERIF, fontSize: pt(BODY), lineHeight: pt(LEAD), color: col('ink'),
      boldColor: col('ink'), textAlign: 'left', firstLineIndent: pt(0),
      tabStops: [{ position: 'end', align: 'end' }] } },
];
// #endregion

// #region folio: a folded kraft card on an oak counter, in daylight
const folio = {
  tilt: 20, yaw: -12,
  paper: { type: 'cardStock', grammage: 250, texture: 'felt', shade: kraft },
  binding: { type: 'folded', cover: 'pages' },
  surface: { type: 'oak' },
  lighting: { environment: 'daylight', intensity: 1.1 },
};
// #endregion

const config = () => ({
  locale: t({ en: 'en-gb', es: 'es' }),
  colorPalette,
  page: { sizePreset: 'custom', width: mm(TRIM_W), height: mm(TRIM_H), dpi: 150,
    backgroundColor: col('kraft'), margins: { top: mm(14), bottom: mm(14), left: mm(MARGIN),
      right: mm(MARGIN) } },
  layout: { layoutType: 'single' },
  bodyText: { fontFamily: SERIF, fontSize: pt(BODY), lineHeight: pt(LEAD), color: col('ink'),
    boldColor: col('ink'), italicColor: col('ink'), textAlign: 'left', firstLineIndent: pt(0),
    hyphenation: { enabled: false }, avoidWidows: true, avoidOrphans: true },
  headings: { fontFamily: DISPLAY, fontWeight: 400, color: col('white'), levels: [
    { level: 1, span: 'page', breakBefore: { enabled: true, parity: 'any' } },
    { level: 2, fontSize: pt(12), lineHeight: pt(LEAD), letterSpacing: pt(1.2),
      textTransform: 'uppercase', marginTop: pt(LEAD), marginBottom: pt(0) }] },
  headingStyles: [cover, opener('wide', 54), opener('square', 56), back],
  paragraphStyles: [dish, story], calloutStyles,
  print: PRINT,
  header: { elements: [] }, footer: { elements: [] }, folio,
});

// ─── 2 · Content ────────────────────────────────────────────────────────────
const markdown = String.raw`---
title: "Horno Alto"
---

# Horno Alto {style="cover" photo="loaf" since="Bakery and café · since 1987" address="Calle del Pozo 14 · Tuesday to Sunday, seven to seven"}

# From the oven {style="wide" photo="pastries" kicker="Bread and pastries"}

## Bread

:::paragraphs{style="dish"}
**Country sourdough**, 800 g, wheat and rye :tab **4.80**\
*Three days from starter to crust, baked at five each morning*

**Seeded rye**, 600 g, sunflower, flax and pumpkin :tab **4.20**\
*Dense and dark, best sliced thin and kept a week*

**Olive oil loaf**, 500 g :tab **3.60**\
*The one we make the toast with*

**Bread of the day**, ask at the counter :tab **3.90**
:::

## Pastries

:::paragraphs{style="dish"}
**Butter croissant** :tab **1.80**\
*Laminated over two days with Asturian butter*

**Cinnamon roll**, sugar glaze :tab **2.40**

**Almond cake**, a slice :tab **3.20**\
*Ground almonds, lemon zest, no flour*

**Cheese and quince twist** :tab **2.60**
:::

# At the counter {style="square" photo="coffee" kicker="Coffee and breakfast"}

## Coffee

:::paragraphs{style="dish"}
**Espresso** :tab **1.40**

**Cortado**, a splash of milk :tab **1.60**

**Café con leche**, large cup :tab **2.10**

**Hot chocolate**, thick, for dipping :tab **2.80**
:::

## Breakfast

:::paragraphs{style="dish"}
**Toast with tomato and olive oil** :tab **3.20**

**Toast with butter and apricot jam** :tab **3.00**

**Croissant and coffee** :tab **3.00**
:::

:::callout{type="bake"}
**Today’s bake.** Pumpkin and walnut loaf, from eleven until it runs out. Ask for a slice warm with butter.
:::

# Since 1987 {style="back"}

:::paragraphs{style="story"}
The oven in the back room was built by Rosa Alto’s father the year the bakery opened, from brick and the clay of the river below the village. It still bakes every loaf. Rosa runs the bakery now with her son Pablo, who came back from three years in a bakery in Lyon with a croissant he would not stop talking about.

We bake with flour from two mills in the province, butter from Asturias and eggs from the farm on the Sigüenza road. What is not sold by seven goes to the shelter on Calle Mayor.
:::

:::callout{type="hours"}
**Tuesday to Friday** :tab 7.00 – 19.00\
**Saturday and Sunday** :tab 8.00 – 19.00\
**Monday** :tab closed
:::

:::paragraphs{style="story"}
*Calle del Pozo 14 · 949 214 387 · We cut whole loaves on request.*
:::
`; // content.<lang>.md, inlined by the Cookbook

const painting = (id, [w, h], altText) => ({ id, typeId: 'painting', kind: 'bitmap',
  createdAt: 0, updatedAt: 0, bitmap: { fileId: `${id}.jpg`, format: 'jpeg', width: w,
    height: h }, altText });
const resourceTypes = [{ id: 'painting', name: '', captionPrefix: '', numberingTemplate: '' }];
const resources = [
  painting('loaf', [700, 683], t({ en: 'A round sourdough loaf with a floured, cross-cut crust, '
    + 'painted in gouache.', es: 'Una hogaza redonda de masa madre con la corteza enharinada '
    + 'y cortada en cruz, pintada al gouache.' })),
  painting('pastries', [900, 396], t({ en: 'A croissant, a glazed cinnamon roll and a slice of '
    + 'almond cake.', es: 'Un cruasán, una caracola de canela glaseada y una porción de tarta '
    + 'de almendra.' })),
  painting('coffee', [600, 600], t({ en: 'A white cup of milky coffee on a saucer, a spoon '
    + 'beside it.', es: 'Una taza blanca de café con leche en su plato, con la cucharilla.' })),
];
await Promise.all([loadImage('loaf.jpg', asset('loaf-700.jpg')),
  loadImage('pastries.jpg', asset('pastries-900.jpg')),
  loadImage('coffee.jpg', asset('coffee-600.jpg'))]);

// ─── 3 · Fonts ──────────────────────────────────────────────────────────────
const FONTS = { 'Alfa Slab One': ['400'], Lora: ['400', '400i', '700'] };

// ─── 4 · Build & show ───────────────────────────────────────────────────────
const doc = await buildDocumentWithFonts({ markdown, resources }, { ...config(), resourceTypes },
  kitFonts(FONTS));
showPages(doc, { title: t({ en: 'Horno Alto · a bakery menu in white ink on kraft',
  es: 'Horno Alto · una carta de panadería en tinta blanca sobre kraft' }) });
offerPdf(() => renderToPdf(doc, { fontProvider: fontsourceProvider, resourceBytes: imageBytes,
  profileBaseUrl: 'https://postext.dev/icc/' }), `${RECIPE}.pdf`);

// #region preflight: what the press check says of the white
// A white ink on white paper prints nothing you can see, and the preflight warns of it
// (whiteInkOnWhite). On kraft it does not fire; the findings left say which special ink the
// job carries and that the press lays the white first.
const findings = preflightDocument(doc);
const report = document.createElement('p');
report.textContent = `Preflight: ${findings.map((f) => f.kind === 'inkPressOrder'
  ? `inkPressOrder (first: ${f.first.join(', ')})` : `${f.kind}${f.ink ? ` (${f.ink})` : ''}`)
  .join('; ') || 'no findings'}`;
document.querySelector(`[data-postext-pdf="${RECIPE}.pdf"]`).after(report);
// #endregion

// The card in the hand, open on the inside, so the white reads against the brown.
const stage = document.createElement('section');
stage.id = 'folio';
stage.ariaLabel = t({ en: 'The menu in 3D', es: 'La carta en 3D' });
stage.style.cssText = 'height: min(78vh, 720px); margin: 0 auto; max-width: 1280px';
document.getElementById('pages').before(stage);
createFolioFromDocument(stage, doc, { at: 2,
  appearance: { textureBaseUrl: 'https://postext.dev/folio/textures' } });

// ─── Kit ── helpers shared by every Cookbook recipe · postext.dev/cookbook ─────

// ─── Kit · core v1 ── the same in every recipe · postext.dev/cookbook
function mm(value) { return { value, unit: 'mm' }; }
function pt(value) { return { value, unit: 'pt' }; }
function em(value) { return { value, unit: 'em' }; }
/** The sample language's string: t({ en: 'Figure', es: 'Figura' }). */
function t(strings) { return strings[LANG] ?? Object.values(strings)[0]; }
/** A file in this recipe's assets folder, served from the Postext repo by jsDelivr. */
function asset(file) { return `https://cdn.jsdelivr.net/gh/drnachio/postext@main/cookbook/${RECIPE}/assets/${file}`; }

// ─── Kit · fonts v3 ── the same in every recipe · postext.dev/cookbook
// Postext loads the faces a config asks for before layout and asks the kit
// for Fontsource's files, the ones the PDF embeds too.

/** buildDocumentWithFonts' options: the resolver, and FONTS' faces loaded
 *  with the config's. FONTS = { 'Family Name': ['400', '400i', '700'] }. */
function kitFonts(FONTS = {}) {
  const faces = Object.entries(FONTS).flatMap(([family, specs]) => specs.map((spec) =>
    ({ family, weight: parseInt(spec, 10), style: spec.endsWith('i') ? 'italic' : 'normal' })));
  return { resolve: fontsourceResolver, faces };
}

/** A face's files with their ranges: latin, then latin-ext and greek when
 *  `text` needs them (kitSubsetsFor). Null for a face Fontsource lacks. */
async function fontsourceResolver(family, weight, style, { text = '' } = {}) {
  const id = fontsourceId(family);
  const meta = await fontsourceMeta(family);
  if (meta && !(await fontsourceWeights(family, style)).includes(weight)) return null;
  kitStatus('Loading fonts…');
  const at = await fontsourceAt(id);
  return ['latin', ...kitSubsetsFor(text, meta)].map((subset) => ({
    source: `${at}files/${id}-${subset}-${weight}-${style}.woff2`,
    unicodeRange: kitRanges()[subset],
  }));
}

/** Each file's unicode-range (a function: the kit runs after the pen's code). */
function kitRanges() {
  return {
    latin: 'U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,'
      + 'U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD',
    'latin-ext': 'U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,'
      + 'U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF',
    greek: 'U+0370-03FF',
  };
}

/** For the cjk, arabic and comics blocks: loads `faces` (as FONTS) for the
 *  sample `text`; `optional` skips a face Fontsource lacks. Files are added in
 *  the order asked, the last winning a shared character. Resolves to the count. */
async function loadFonts(faces, text = '', { optional = false } = {}) {
  kitStatus('Loading fonts…');
  const ranges = kitRanges();
  const jobs = [];
  for (const [family, specs] of Object.entries(faces)) {
    const id = fontsourceId(family);
    const todo = [...new Set(specs)].map((spec) => [parseInt(spec, 10), spec.endsWith('i') ? 'italic' : 'normal'])
      .filter(([weight, style]) => !hasFace(family, weight, style)); // before any await
    const at = fontsourceAt(id);
    const meta = optional || /[^\0-ÿ]/u.test(text) ? await fontsourceMeta(family) : null;
    const subsets = ['latin', ...kitSubsetsFor(text, meta)];
    for (const [weight, style] of todo) {
      if (optional && !(meta && (await fontsourceWeights(family, style)).includes(weight))) continue;
      for (const subset of subsets) {
        const url = `${await at}files/${id}-${subset}-${weight}-${style}.woff2`;
        const face = new FontFace(family, `url(${url}) format('woff2')`,
          { weight: String(weight), style, unicodeRange: ranges[subset] });
        jobs.push(face.load().catch(() => {
          if (subset === 'latin' && !optional) throw new Error(`Fontsource has no ${family} ${weight} ${style}`);
        }));
      }
    }
  }
  const ready = await Promise.all(jobs).catch((error) => { kitFail(error); throw error; });
  return ready.filter((face) => face && document.fonts.add(face)).length;
}

/** A loaded FontFace covers this face (fonts.check() says yes to any family). */
function hasFace(family, weight, style) {
  for (const face of document.fonts) {
    if (face.status !== 'loaded' || face.style !== style) continue;
    if (face.family.replace(/^["']|["']$/g, '') !== family) continue;
    const [low, high = low] = face.weight.split(' ').map(Number);
    if (weight >= low && weight <= high) return true;
  }
  return false;
}

/** The files beyond latin `text` needs that `meta`'s family ships. */
function kitSubsetsFor(text, meta) {
  return [[/[Ā-˿ᴀ-ᶿḀ-ỿ†ℓⱠ-Ɀ꜠-ꟿ]/u, 'latin-ext'], [/[Ͱ-Ͽ]/u, 'greek']]
    .filter(([re, x]) => re.test(text) && meta?.subsets?.includes(x)).map(([, x]) => x);
}

/** Fontsource's id for a family: 'Source Serif 4' → 'source-serif-4'. */
function fontsourceId(family) { return family.toLowerCase().replace(/\s+/g, '-'); }

/** A package's folder at the one version @5 names now (#766). */
function fontsourceAt(id, u = `https://cdn.jsdelivr.net/npm/@fontsource/${id}@`) {
  return (fontsourceAt.c ??= {})[id] ??= fetch(u + '5/package.json').then((r) => r.json())
    .then((p) => p.version || 5, () => 5).then((v) => `${u}${v}/`);
}

/** The family's Fontsource metadata (weights, styles, subsets), or null. */
function fontsourceMeta(family, id = fontsourceId(family)) {
  return (fontsourceMeta.c ??= {})[id] ??= fetch(`https://api.fontsource.org/v1/fonts/${id}`)
    .then((res) => (res.ok ? res.json() : null), () => null);
}

/** The weights the package ships in `style`: the API pairs none (no Libre
 *  Caslon 700 italic file), so italics are read from latin-italic.css. */
function fontsourceWeights(family, style, id = fontsourceId(family)) {
  return (fontsourceWeights.c ??= {})[id + style] ??= fontsourceMeta(family).then(async (m) => {
    if (!m?.styles.includes(style)) return m ? [] : [400, 700];
    const css = style === 'italic' ? await fetch(`${await fontsourceAt(id)}latin-italic.css`).then((r) => (r.ok ? r.text() : ''), () => '') : '';
    const w = [...css.matchAll(/weight: (\d+)/g)].map((x) => +x[1]);
    return w.length ? w : m.weights;
  });
}

// ─── Kit · viewer v2 ── the same in every recipe · postext.dev/cookbook
/** The pages as spreads on a dark desk, page 1 alone, then verso | recto,
 *  each painted when it scrolls near. Other options go to renderPageToCanvas. */
function showPages(docs, { title, width = 460, ...render } = {}) {
  const root = viewer(title);
  const pages = [docs].flat().flatMap((doc) =>
    doc.pages.map((page) => ({ doc, page, n: (doc.pageIndexOffset ?? 0) + page.index })));
  const spreads = [];
  let verso = null;
  for (const p of pages) {
    if (p.n % 2 === 1) { if (verso) spreads.push([verso, null]); verso = p; }
    else { spreads.push([verso, p]); verso = null; }
  }
  if (verso) spreads.push([verso, null]);
  const density = Math.min(window.devicePixelRatio || 1, 2);
  showPages.painter?.disconnect();
  const painter = new IntersectionObserver((entries) => {
    for (const { isIntersecting, target } of entries) {
      if (!isIntersecting) continue;
      painter.unobserve(target);
      const { doc, page } = target.postext;
      renderPageToCanvas(page, doc, target, { ...render, scale: (width * density) / page.width });
    }
  }, { rootMargin: '800px' });
  showPages.painter = painter;
  root.replaceChildren(...spreads.map((pair) => {
    const spread = document.createElement('div');
    spread.className = 'pt-spread';
    for (const p of pair) {
      const figure = document.createElement('figure');
      if (p) {
        const label = p.page.pageLabel || String(p.n + 1);
        const canvas = document.createElement('canvas');
        canvas.postext = p;
        canvas.style.aspectRatio = `${p.page.width} / ${p.page.height}`;
        canvas.setAttribute('role', 'img');
        canvas.setAttribute('aria-label', `Page ${label}`);
        const folio = document.createElement('figcaption');
        folio.textContent = label;
        figure.append(canvas, folio);
        painter.observe(canvas);
      } else figure.className = 'pt-blank';
      spread.append(figure);
    }
    return spread;
  }));
  kitStatus(`${pages.length} ${pages.length === 1 ? 'page' : 'pages'}`);
  document.documentElement.dataset.postext = 'ready';
  return pages.length;
}

/** The desk, the bar and the error reporting, created once. */
function viewer(title) {
  if (!document.getElementById('pt-kit')) {
    document.head.insertAdjacentHTML('beforeend', `<style id="pt-kit">
      :root { color-scheme: dark; }
      body { margin: 0; background: #0e1014; color: #b9bcc4; font: 13px/1.45 system-ui, sans-serif; }
      #pt-bar { position: sticky; top: 0; z-index: 1; display: flex; flex-wrap: wrap; align-items: center;
        gap: 6px 16px; padding: 10px 16px; background: rgb(14 16 20 / .92); backdrop-filter: blur(6px);
        border-bottom: 1px solid #23262d; }
      #pt-bar strong { color: #f4f1ea; font-weight: 600; }
      #pt-actions { display: flex; gap: 12px; margin-left: auto; }
      #pt-actions a, #pt-actions button { color: #d8a21a; font: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
      #pages { display: grid; justify-items: center; gap: 48px; padding: 32px 16px 72px; }
      .pt-spread { display: flex; }
      .pt-spread figure { margin: 0; width: min(460px, 44vw); }
      .pt-spread canvas { display: block; width: 100%; background: #fff;
        box-shadow: 0 1px 2px rgb(0 0 0 / .5), 0 22px 44px -16px rgb(0 0 0 / .8); }
      .pt-spread figure:first-child canvas { box-shadow: inset -14px 0 14px -14px rgb(0 0 0 / .18), 0 1px 2px rgb(0 0 0 / .5), 0 22px 44px -16px rgb(0 0 0 / .8); }
      .pt-spread figcaption { margin-top: 10px; text-align: center; font: 600 10px/1 system-ui, sans-serif;
        letter-spacing: .18em; text-transform: uppercase; color: #6c7079; }
      .pt-blank { visibility: hidden; }
      @media (max-width: 760px) {
        .pt-spread { flex-direction: column; gap: 32px; }
        .pt-spread figure { width: min(460px, 92vw); }
        .pt-blank { display: none; }
      }
    </style>`);
    document.body.insertAdjacentHTML('afterbegin',
      '<header id="pt-bar"><strong id="pt-title"></strong><span id="pt-status" role="status"></span><span id="pt-actions"></span></header>');
    document.getElementById('pt-title').textContent = document.title || 'Postext';
    addEventListener('error', (event) => kitFail(event.error ?? event.message));
    addEventListener('unhandledrejection', (event) => kitFail(event.reason));
  }
  if (title) document.getElementById('pt-title').textContent = title;
  return document.getElementById('pages')
    ?? document.body.appendChild(Object.assign(document.createElement('main'), { id: 'pages' }));
}

function kitStatus(text) {
  viewer();
  document.getElementById('pt-status').textContent = text;
}

function kitFail(error) {
  document.documentElement.dataset.postext = 'error';
  kitStatus(`Error: ${error?.message ?? error}`);
}

// ─── Kit · pdf v3 ── the same in every recipe that exports a PDF
/** The Fontsource files the screen used, as TrueType, with their range and
 *  place: the nearest weight the family ships in that style, upright with no italic;
 *  latin, then what its letters need (kitSubsetsFor). */
async function fontsourceProvider(family, weight, style, request) {
  const id = fontsourceId(family);
  const meta = await fontsourceMeta(family);
  const s = style === 'italic' && meta && !meta.styles.includes('italic') ? 'normal' : style;
  const shipped = meta ? await fontsourceWeights(family, s) : [];
  const weights = shipped.length ? shipped : [400, 700];
  const w = weights.reduce((a, b) => (Math.abs(b - weight) < Math.abs(a - weight) ? b : a));
  const text = String.fromCodePoint(...(request?.codePoints ?? []));
  const files = await Promise.all(['latin', ...kitSubsetsFor(text, meta)].map(async (subset, order) => {
    const res = await fetch(`${await fontsourceAt(id)}files/${id}-${subset}-${w}-${s}.woff2`);
    if (!res.ok) throw new Error(`Fontsource has no ${family} ${w} ${s} ${subset}`);
    return Object.assign(await decompressWoff2(new Uint8Array(await res.arrayBuffer())),
      { unicodeRange: kitRanges()[subset], order });
  }));
  return files.length === 1 ? files[0] : files;
}

/** A "Build the PDF" button; then "Open the PDF" (a new tab: CodePen's frame
 *  shows no PDFs) and a download link. */
function offerPdf(makePdf, filename) {
  viewer();
  const button = Object.assign(document.createElement('button'), { type: 'button', textContent: 'Build the PDF' });
  button.dataset.postextPdf = filename;
  button.addEventListener('click', async () => {
    button.disabled = true;
    button.textContent = 'Building the PDF…';
    try {
      const bytes = await makePdf();
      const url = URL.createObjectURL(new Blob([bytes], { type: 'application/pdf' }));
      const size = `${Math.max(1, Math.round(bytes.length / 1024))} KB`;
      button.replaceWith(
        Object.assign(document.createElement('a'), { href: url, target: '_blank', rel: 'noopener', textContent: 'Open the PDF ↗' }),
        Object.assign(document.createElement('a'), { href: url, download: filename, textContent: `Download ${filename} · ${size}` }));
    } catch (error) {
      button.disabled = false;
      button.textContent = 'Build the PDF';
      kitFail(error);
    }
  });
  document.getElementById('pt-actions').append(button);
}

// ─── Kit · images v3 ── recipes with pictures · postext.dev/cookbook
/** Registers a photo or PNG for the canvas and keeps its bytes for the PDF.
 *  fetch → ImageBitmap never taints the canvas (a plain cross-origin <img> would). */
async function loadImage(fileId, url) {
  const res = await fetch(url);
  if (!res.ok) throw new Error(`Image not found (${res.status}): ${url}`);
  const bytes = new Uint8Array(await res.arrayBuffer());
  registerResourceImage(fileId, await createImageBitmap(new Blob([bytes])));
  (loadImage.bytes ??= new Map()).set(fileId, bytes);
}

/** Registers SVG markup as a vector image, its fonts inside (inlineSvgFonts, ≥ 1.25).
 *  `options` go to registerResourceImage: { singleInk: true } tints it on the canvas. */
async function loadSvg(fileId, svg, options) {
  if (typeof inlineSvgFonts === 'function') svg = await inlineSvgFonts(svg, svgFaces);
  const img = new Image();
  img.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`;
  await img.decode();
  registerResourceImage(fileId, img, options);
  (loadImage.bytes ??= new Map()).set(fileId, new TextEncoder().encode(svg));
}

/** A face's Fontsource files: nearest weight; latin + what the SVG sets. */
async function svgFaces(family, weight, style, { codePoints = [] } = {}) {
  const [id, m] = [fontsourceId(family), await fontsourceMeta(family)];
  const w = m?.weights.reduce((a, b) => (Math.abs(b - weight) < Math.abs(a - weight) ? b : a)) ?? weight;
  const s = m?.styles.includes(style) === false ? 'normal' : style;
  return Promise.all(['latin', ...kitSubsetsFor(String.fromCodePoint(...codePoints), m)].map(async (x) => new Uint8Array(
    await (await fetch(`${await fontsourceAt(id)}files/${id}-${x}-${w}-${s}.woff2`)).arrayBuffer())));
}

/** renderToPdf({ resourceBytes: imageBytes }) */
function imageBytes(fileId) { return loadImage.bytes?.get(fileId); }

/** renderToHtml({ resourceImageUrl: imageUrl }) */
function imageUrl(fileId) {
  const bytes = imageBytes(fileId);
  if (!bytes) return undefined;
  imageUrl.urls ??= new Map();
  if (!imageUrl.urls.has(fileId)) {
    const type = /\.svg$/i.test(fileId) ? 'image/svg+xml' : /\.png$/i.test(fileId) ? 'image/png' : 'image/jpeg';
    imageUrl.urls.set(fileId, URL.createObjectURL(new Blob([bytes], { type })));
  }
  return imageUrl.urls.get(fileId);
}

// ─── /Kit ───────────────────────────────────────────────────────────────────────
```

## Variantes

### Une couverture de carnet

Remplacez le menu par un titre et un motif de filets blancs en couverture : le papier, l'encre et la table des encres restent tels quels.

### Deux passages de blanc

Un imprimeur peut passer le blanc deux fois pour un blanc plus franc sur un kraft foncé. Demandez-le sur la commande ; le fichier ne change pas, avec une seule plaque de blanc.

## Erreurs fréquentes

- Une encre blanche sur une page dont le papier est blanc ou non défini n'imprime rien de visible. Réglez `page.backgroundColor` sur le support, en CMJN à 0 %, et le contrôle cesse d'avertir.
- Une image imprimée directement sur le kraft, sans blanc dessous, laisse voir le brun dans tous ses tons clairs. Placez un bloc du blanc sous chaque image qui doit garder ses couleurs, comme le font ici les passe-partout.
- Un texte blanc sur une couleur ne doit pas être en surimpression. Avec la valeur par défaut, il s'imprime sous la couleur et disparaît.

## Crédits

- Recette: Ignacio Ferro ([@drnachio](https://github.com/drnachio))
- Images: A sourdough loaf, on the cover: Generated With Diffusion Models, original
- Images: Three pastries: Generated With Diffusion Models, original
- Images: A cup of coffee: Generated With Diffusion Models, original
- Caractères: Alfa Slab One (OFL-1.1), Lora (OFL-1.1)
- Code: MIT · Contenu d’exemple: CC-BY-4.0

## Recettes liées

- [Nº 052 · Carte de bistrot : les prix sur un taquet de tabulation](https://postext.dev/fr/cookbook/bistro-menu.md): Une carte de bistrot recto verso : prix au fer à droite sur un taquet, vins dans un tableau sans filets et un filet laiton ancré de chaque côté des titres. · Niveau 2 (Intermédiaire) · Feuilles volantes et éphémères
- [Nº 188 · Dorure à chaud sur une couverture bleu nuit](https://postext.dev/fr/cookbook/gold-foil-poetry-cover.md): La dorure comme ton direct avec une finition : sa propre plaque dans le PDF, l’éclat dans Folio, et une carte bleue et un vélin crème sans encre. · Niveau 3 (Avancé) · Poésie
- [Nº 195 · Un livre tunnel de vingt feuillets de profondeur](https://postext.dev/fr/cookbook/forest-tunnel-book.md): Dix-neuf fenêtres rondes découpées avec dieCuts, chacune plus petite que la précédente : de la couverture, on voit à travers vingt plans jusqu’à un cerf. · Niveau 3 (Avancé) · Feuilles volantes et éphémères
