Recipe: page options
This recipe builds a Dunder Mifflin paper catalog in one PDF: a cover, then one page per product with its name and price. The page numbers count the pages that are actually printed.
You’ll learn the page’s Repeat, page numbers and the Page number and Page count variables, and how to spread a long list over several pages.


The page bar
Section titled “The page bar”Click an empty area of the canvas so that nothing is selected. The context bar becomes the page bar.
| Control | What it does |
|---|---|
| Page N | The page you’re on |
| Repeat | Export the page once per item of a list variable |
| Show | Export the page only when a boolean is true (or false) |
| Page numbers | Number every page of the template |
The same Repeat and Show are in the ⋯ menu of each thumbnail in the pages panel, and a thumbnail shows a badge when its page is bound.
1. Create the template
Section titled “1. Create the template”On My Templates, click New Template. Name it Paper catalog, choose A4 portrait and
click Create.
2. Declare the variables
Section titled “2. Declare the variables”| Name | Type | Settings |
|---|---|---|
products |
List | Max items 100. Item fields: name (String, 40, required) and price (String, 12, required) |
Give products a couple of default items, such as A4 copy paper and envelopes, so the preview
has something to show.
3. The cover
Section titled “3. The cover”Page 1 is a plain page with fixed text: DUNDER MIFFLIN PAPER COMPANY, then Paper catalog in
large type and Scranton branch under it. Nothing to bind.
4. One page per product
Section titled “4. One page per product”-
Click + Add in the pages panel to add page 2. Draw a text box near the top for the product’s name, in bold, 64, and a second one under it for the price, in 40.
-
With nothing selected, click Repeat in the page bar and pick
products. The button reads Repeat: products, and the thumbnail shows a ⟳ badge. -
Bind the texts to the current product. Put the caret in the first text box, click Variable (⚡) and pick
products.name, then do the same withproducts.pricein the second. The item’s fields are offered once the page repeats.
The editor shows the page once. In the PDF, the page is replaced by one copy per product, in the list’s order. An empty list leaves the page out.
5. Number the pages
Section titled “5. Number the pages”-
In the page bar, click Page numbers (the # button) and switch on Number the pages. A text box appears at the bottom right of every page.
-
Check Skip the first page. The cover gets no number but still counts, so the first product page shows 2.
-
Select the number on any page to restyle, move or reword it, and every page follows. For Page 2 of 5, type
Page, insert Variable → Page → Page number, typeof, and insert Page count.
Page numbers are counted in the PDF, after repeated pages are copied. With 4 products, the product pages read Page 2 of 5 to Page 5 of 5. A repeated page shows the number on all its copies or on none.
Page number and Page count work in any text box, outside the numbering too: Catalog (5 pages) on the cover, or a reference such as p. 3 in a header.
Long lists over several pages
Section titled “Long lists over several pages”Nothing flows from one page to the next, so a table longer than its page loses its last rows, with a warning. To print a list of any length, cut it into pages in your code and let a repeated page draw them.
-
Declare a
pagesvariable of type List, with the item fieldslines(List, with the fields of a line) andisLast(Boolean). -
Design one page of the table, as in Lists and tables, and set the page’s Repeat to
pages. -
Set the line row’s Repeat to
pages.lines, under Item lists. Each page copy draws its own lines, read frompages.lines.label,pages.lines.amount… -
Set the total row’s Show to
pages.isLast, so the total prints on the last page only.
Then send the lines in chunks of as many as a page holds:
const LINES_PER_PAGE = 15;
const pages = [];for (let i = 0; i < lines.length; i += LINES_PER_PAGE) { pages.push({ lines: lines.slice(i, i + LINES_PER_PAGE), isLast: false });}pages.at(-1).isLast = true;
const body = { clientName: 'Bob Vance', total: '$12,480.00', pages };With a cover before it and the numbering on, a 40-line invoice for Vance Refrigeration prints as Page 2 of 4 to Page 4 of 4, with its total on the last page.
More ideas
Section titled “More ideas”- Dundie Awards for the whole office in one PDF: a single page repeated on
nominees, each copy readingnominees.nameandnominees.category. - Employee badges ready to print: the badge design on a page repeated on
employees, with one request for the whole Scranton branch. - A table on each product page: a
variantslist field, drawn by a group repeated onproducts.variants(see Lists and tables).