---
source: https://carbone.io/examples/recipe-book/
title: "Recipe Management Software: Recipe Books and Cards | Carbone"
description: "Generate recipe books and meal kit recipe cards in PDF from your recipe management software with the Carbone API: photos, nutrition table, allergens and a TOC."
generated_at: "2026-11-17"
---

# Illustrated recipe book

Recipe spreads with nutrition and allergens, from your recipe system

[![Illustrated recipe book: PDF generated from a DOCX template and JSON data](/examples/recipe-book/thumb-result.webp)](/examples/recipe-book/result.pdf "Download the generated document")

[Download template](/examples/recipe-book/template.docx)

[Sample data](/examples/recipe-book/data.json)

[Download the generated PDF](/examples/recipe-book/result.pdf)

- **Template:** DOCX
- **Export as:** PDF, DOCX, ODT, HTML, PNG [+25 more](/documentation/developer/http-api/generate-reports.md#output-file-type)
- **Carbone:** 4.0+

Features

-   [Loop](/documentation/design/repetitions/with-arrays.md)
-   [Nested loop](/documentation/design/repetitions/with-arrays.md)
-   [Image](/documentation/design/advanced-features/pictures.md)
-   [Barcode](/documentation/design/advanced-features/barcode.md)
-   [Math](/documentation/design/computation/simple-mathematics.md)
-   [Alias](/documentation/design/substitutions/aliases.md)
-   Index
-   Table of contents
-   [Pagination](/documentation/design/advanced-features/pagination.md)

## Generate recipe books from your recipe management software

Food brands, meal kit companies and retailers keep their recipes in a recipe management system or a PIM: ingredients, method, yield, nutrition and allergens. Each season, they publish the same records as recipe cards, booklets and printed collections. The system sends the recipes to the Carbone API as JSON, and this DOCX template returns the book as a PDF: a cover, a table of contents, a welcome page, one spread per recipe and a back page with a QR code.

Here, Larkfield Kitchen, a fictional meal kit brand, publishes Autumn Table, a collection of five recipes. Each recipe page shows the yield, the portion, the times, the ingredients in grams and millilitres, the numbered method, the equipment, the allergens and the storage advice. The nutrition table follows the format of the EU nutrition declaration of [Regulation (EU) No 1169/2011](https://eur-lex.europa.eu/eli/reg/2011/1169/oj): the order and the names of Annex XV, per 100 g and per serving, with the percentage of the reference intakes. The allergens carry the names of its Annex II.

In this example, you will:

-   Repeat a two-page spread for each recipe, with a full-page photo
-   List the ingredients, the equipment and the numbered method steps
-   Compute the percentages of the reference intakes with formatters
-   Insert a QR code
-   Fill a table of contents and the page numbers

## How to build a recipe book in Word

### 1\. Lay out the pages

In Word, create a DOCX document with a cover, a contents page, a welcome page, a recipe spread and a back page. The first paragraph of each page has **Page break before** (Paragraph > Line and Page Breaks), so no empty paragraph or manual break shifts the layout.

-   The photo of the cover and the photo of each spread are pictures anchored to the page at 0, 0, at the full size of the A4 page, and placed **Behind Text**.
-   In **Header & Footer**, check **Different First Page** and **Different Odd & Even Pages**. The header and the page number sit only in the odd header and footer, so they print on the right-hand recipe pages and the photos stay full-bleed.
-   The recipe page is one table. Its first row holds the title and the introduction, with a minimum height and a bottom alignment, so the facts row starts at the same place whether the title takes one line or two.

_The welcome page keeps each photo on a left page, facing its recipe._

### 2\. Repeat a spread for each recipe

Display the data with [Carbone tags](/documentation/design/substitutions/the-basics.md) in a [loop](/documentation/design/repetitions/with-arrays.md#simple-array):

-   On the cover, add `{d.book.title}`, `{d.book.subtitle}` and `{d.book.season}`
-   On the recipe page, add `{d.recipes[i].course}`, `{d.recipes[i].code}`, `{d.recipes[i].title}` and `{d.recipes[i].intro}`, then the facts: `{d.recipes[i].servings}`, `{d.recipes[i].portionWeight} g`, `{d.recipes[i].prepTime} min`, `{d.recipes[i].cookTime} min`, `{d.recipes[i].totalTime} min` and `{d.recipes[i].difficulty}`
-   Print the dietary marks and the allergens on one line with [:arrayJoin](/documentation/design/formatters/array.md#arrayjoin-separator-index-count): `{d.recipes[i].diet:arrayJoin(' · ')}` and `{d.recipes[i].allergens:arrayJoin(', ')}`
-   After the recipe table, add `{d.recipes[i+1].title}` to end the loop. Carbone removes this paragraph and repeats the photo page and the recipe page for each recipe

The ingredients, the equipment and the method are [nested arrays](/documentation/design/repetitions/with-arrays.md#nested-arrays). Write the item of the current recipe, and the next item on the line below. A tab separates the quantity from the ingredient:

```text
{d.recipes[i].ingredients[i].qty}    {d.recipes[i].ingredients[i].item}
{d.recipes[i].ingredients[i+1].qty}
```

The step number is the [loop iterator value](/documentation/design/repetitions/with-arrays.md#access-the-loop-iterator-value). `..i` is the index of the step, which starts at 0, so [:add(1)](/documentation/design/formatters/number.md#add-value) numbers the steps from 1 in each recipe:

```text
{d.recipes[i].method[i].text:print(..i):add(1)}  {d.recipes[i].method[i].text}
{d.recipes[i].method[i+1].text}
```

### 3\. Insert the photos and the QR code

Insert a [placeholder image](/documentation/design/advanced-features/pictures.md#simple-image-docx), right-click it, select **View Alt Text**, and type the tag:

-   `{d.book.cover}` for the cover photo
-   `{d.recipes[i].photo}` for the photo of each recipe
-   `{d.book.url:barcode(qrcode)}` on the back page: the [:barcode](/documentation/design/advanced-features/barcode.md#barcodes-as-image) formatter replaces the image with a QR code that contains the URL

_The photos have the proportions of an A4 page, so they fill it at the default `fillWidth` fit. They can be URLs or Base64 data URIs, as in this example._

### 4\. Fill the nutrition table

The rows follow the order of Annex XV: energy in kJ and kcal, fat, of which saturates, carbohydrate, of which sugars, fibre, protein and salt. The recipe system sends the values already rounded, as text (`"1.0"`, `"0.33"`), so the template prints them as declared.

[Parametrized aliases](/documentation/design/substitutions/aliases.md#parametrized-alias) keep the tags short. They are defined in the paragraph that ends the loop:

```text
{#p100 = d.recipes[i].nutrition.per100g}
{#srv = d.recipes[i].nutrition.perServing}
{#ri($key, $intake) = d.recipes[i].nutrition.perServing.$key:div($intake):mul(100):round(0)}
```

Each row then holds three short tags, like `{$p100.fat} g`, `{$srv.fat} g` and `{$ri(fat,70)}%`. The `ri` alias divides the value per serving by the reference intake with [:div](/documentation/design/formatters/number.md#div-value), [:mul](/documentation/design/formatters/number.md#mul-value) and [:round](/documentation/design/formatters/number.md#round-precision). The reference intakes of Annex XIII are 2000 kcal for energy, 70 g for fat, 20 g for saturates, 260 g for carbohydrate, 90 g for sugars, 50 g for protein and 6 g for salt. Fibre has none, so its cell stays empty.

The column header gives the portion, `Per serving ({d.recipes[i].portionWeight} g)`, and the note under the table carries the statement of Article 32(5): "Reference intake of an average adult (8 400 kJ/2 000 kcal)".

### 5\. Add the table of contents and the page numbers

-   Apply the **Heading 1** style to `{d.recipes[i].title}`
-   On the contents page, go to **References** > **Table of Contents** and choose a style. Like the recipes, the table of contents holds a loop: `{d.recipes[i].title}` on the first entry and `{d.recipes[i+1].title}` on the second
-   The paragraph that opens the table of contents field has a size of 1 pt and an exact line spacing of 1 pt, so no empty line shows above the first entry. Keep the field code at the size of the text

Carbone [updates the table of contents](/documentation/design/advanced-features/pagination.md#insert-table-of-contents) with the title and the page of each recipe.

For the page numbers, go to **Insert** > **Page Number** in the odd footer. Carbone [updates the page numbers](/documentation/design/advanced-features/pagination.md#insert-page-number) in the generated document. Tags also work in headers and footers: the header prints `{d.book.title}` and the footer `{d.book.collection}`.

## Related Examples

Check out these similar templates to learn more:

- [Solar quote with datasheets](/examples/quote-with-datasheet/index.md): DOCX template to PDF.
- [GHS safety data sheet](/examples/safety-data-sheet/index.md): DOCX template to PDF.
- [Project status report](/examples/mission-report/index.md): DOCX template to PDF.

## Related topics

- [Daily restaurant menu](/examples/menu/index.md)
- [Editor.js to PDF and Word](/examples/editorjs/index.md)
- [Fill an existing PDF form](/examples/pdf-form-template/index.md)
