Skip to main content

Customer Newsletter

A quarterly customer brief built from five shared components, each filled through its params, under a PDF/A-2b claim.

  • Masthead. It comes from newsletter-masthead, used by the document itself: the title and issue line, a running header over a rule and a footer with page numbers.
  • Editor's word. A pull quote from newsletter-pull-quote, followed by the editor's name and role from data.
  • Tip of the quarter. It comes from newsletter-tip, placed as an aside and framed by the host's asideBox style, which closes the box the component's heading opens.
  • In depth. newsletter-case-study as an article, its before-and-after metrics passed as an array and set as a table.
  • What is new. A table bound to $data.updates, then the small print from newsletter-small-print.
  • Reply form. Text fields for name and email, a choice list, two checkboxes and a QR code to the preferences page.

Features used: PDF/A-2b conformance, columns, tables, SVG, barcodes (qrcode), form fields (checkbox, choice, text), data binding, components

How it's built​

The masthead frames the document​

The masthead is placed by a use at the document's top level, beside metadata. Its content goes ahead of the document's own, and since the document declares no header or footer, it takes the component's: the running band over a rule and the page-numbered footer.

"use": [
{
"name": "newsletter-masthead",
"version": "1.1",
"params": {
"title": "$data.issue.title",
"issue": "$data.issue.number",
"date": "$data.issue.date",
"company": "$data.company.name"
}
}
]

Each param is a path into the newsletter's data. Inside the component the same values read as $data.title, $data.issue, $data.date and $data.company, and the component's own params give a default for each one the use leaves out.

A component as a quote, an aside or an article​

as says what the placed content is to the document: quote, aside, article or fragment. It changes the structure, not the drawing. style on the use goes to every top-level item of the component that names no style of its own:

{
"use": {
"name": "newsletter-tip",
"version": "1.1",
"as": "aside",
"style": "asideBox",
"params": {
"heading": "Save a view",
"tip": "Set up a dashboard once, save it as a view and share the link: everyone sees the same filters, and nobody rebuilds them on Monday."
}
}
}

The tip's heading keeps the component's tipHead, a border on three sides with borderBottom: "none". The tip text names no style, so it takes the document's asideBox, the same border with borderTop: "none". Together they draw one box.

Arrays as rows​

newsletter-case-study takes metrics as an array of objects. Inside the component a table names that array as its source, and the row written with $item tokens is drawn once per entry:

{
"table": {
"widths": [4, 2, 2],
"source": "$data.metrics",
"rows": [
[{ "th": "Measure" }, { "th": "Before" }, { "th": "After" }],
[{ "td": "$item.measure" }, { "td": "$item.before" }, { "td": "$item.after" }]
]
}
}

The "What is new" table does the same on the document, with "source": "$data.updates" and $item.area, $item.change and $item.when. The reply form is a columns block of field nodes, and the QR code is the [barcode, qrcode, https://example.com/newsletter/preferences, 56|56] tag in a paragraph.