# Designing report PDFs

Use **Edit PDF template** in the report editor to open a separate editor
with suggestions for tags, attributes and values. Hover over a name for help,
use the outline to navigate, and select an error to find it in your template. Apply
changes to update only that template, preserving surrounding report source.
Write the `<pdf>` document directly inside `<template>`. Validation, suggestions and data-expression help work directly inside the report.
Expressions are evaluated when you preview or run the report.

```xml
<pdf size="A4" orientation="portrait" margin="40">
  <text size="22" font="Helvetica-Bold">Customer register</text>
  <view t:if="parameters.showNote"><text margin-top="8">Requested note</text></view>
  <view t:else=""><text>No note requested</text></view>
  <table width="515">
    <row t:for="datasets.customers" t:as="customer">
      <cell width="100%"><text t:text="customer.name"/></cell>
    </row>
  </table>
  <qrcode value="report-reference" width="72" height="72"/>
</pdf>
```

PDF context contains `parameters`, `datasets`, named source values and
`reportMeta`. Preparation may add fields. `t:for` binds `t:as` locally;
`t:let` binds a value. `t:if`, sibling `t:elseif` and `t:else` select branches.
`t:text`, `t:src`, `t:value` and `t:attr-*` evaluate expressions;
ordinary attributes and text are literals. Namespace-aware templates may bind
any directive prefix to `urn:cococo:template` and element prefixes to
`urn:cococo:pdf`; qualified names resolve by URI. Unqualified PDF elements
and `t:` without a namespace declaration are also supported. Do not use workflow `{{…}}`
interpolation. Suggestions include declared parameters, datasets and local
names. Fields supplied by a query or script may only be known when you run
the report; preview to check those paths.

Dimensions are points (72 per inch). Width also accepts percentages;
percentage heights are not supported by Reports. The default page is A4
portrait with 40-point margins. Consecutive whitespace in text becomes a single space.
Use fonts available in your installation. Images must be embedded PNG/JPEG
data URIs; URLs and server file paths are unavailable.

Top-level table rows paginate independently. Plain views can continue across pages;
styled groups stay together on one page. Oversized blocks, over-wide words and fixed-height
clipping fail explicitly. `colspan` does not merge cells; use explicit cell widths. PDF preview remains necessary to
inspect data-dependent wrapping, page breaks, fonts and barcode values.
Runs allow at most 100 PDF pages. See the Reports operations guide for data,
storage, retention, authorization and scheduling limits.