# Create your first PDF

Render a PDF from an existing HTML/CSS template: test data, publish, and download the output.

## Before you start
To help you get familiar with Tembuilder, we’ll walk you through creating your first PDF from an existing invoice template. You’ll try editing the content, changing the data, and previewing the result before generating a PDF, all within the app.

Before you begin, sign in and go to the **Templates** dashboard. You can add a template to your project using either method below.

## 1. Choose and open a template
Use an existing ZIP file or choose a template from Gallery.

### Method 1: Import a ZIP file

[Download the invoice template (.zip)](/docs/examples/invoice-template.zip), click **Import** in **Templates**, and select the downloaded file. Enter a name and slug for the template, then wait for the import to finish.

<figure class="doc-sim" aria-label="Import the ZIP, then open the new template in Templates.">
<div class="sim-location"><span>Templates</span><span>TEMBUILDER</span></div>
<div class="sim-stage"><div class="sim-template-head"><strong>Templates</strong><div class="sim-actions"><span class="sim-control sim-focus">↥ &nbsp; Import</span><span class="sim-control sim-dark">＋ &nbsp; New template</span></div></div><div class="sim-template-card"><span class="sim-file">▤</span><div><strong>My first invoice</strong><small>my-first-invoice</small></div><span class="sim-badge">Draft</span><span class="sim-arrow">↗</span></div></div>
<figcaption>Templates · Import</figcaption>
</figure>

### Method 2: Choose a template from Gallery

Open **Gallery**, select an invoice template, and preview the design. Add it to your project, enter a name and slug, and wait for completion.

<figure class="doc-sim" aria-label="Preview a Gallery template and select Use template to add it to your project.">
<div class="sim-stage"><div class="sim-gallery-dialog"><div class="sim-gallery-heading"><div><strong>Monochrome Service Invoice</strong><small>Gallery · Invoice</small></div><span aria-hidden="true">×</span></div><div class="sim-gallery-preview"><div class="sim-paper"><div class="sim-paper-brand">Tembuilder</div><div class="sim-invoice-title">INVOICE <small>TB-2026-0042</small></div><div class="sim-bill"><small>BILL TO</small><b>Tembuilder</b></div><div class="sim-paper-lines"><i></i><i></i><i></i></div><div class="sim-total"><small>TOTAL DUE</small><b>$597.20</b></div></div></div><div class="sim-gallery-footer"><small>A4 · 1 page</small><span class="sim-control sim-dark sim-focus">Use template</span></div></div></div>
<figcaption>Gallery → Use template</figcaption>
</figure>

### Open the template in the editor

After adding a template using either method, open it in **Templates** to start editing.

In the editor, select a section in **Structure**. Available HTML, CSS, Props and Config tabs depend on your selection. Try changing a label in Props if the template provides that field, then check the preview.

<figure class="doc-sim" aria-label="Select Billing Parties in Structure → open Props → edit the fromLabel value.">
<div class="sim-location"><span>Editor / Structure → Props</span><span>TEMBUILDER</span></div>
<div class="sim-stage"><div class="sim-editor"><div class="sim-tree"><div class="sim-panel-title">▦ &nbsp; STRUCTURE <span>＋</span></div><div class="sim-tree-row">⌄ &nbsp; Global</div><div class="sim-tree-child sim-muted">▤ &nbsp; Footer</div><div class="sim-tree-row">⌄ &nbsp; 01 Invoice <small>5</small></div><div class="sim-tree-child sim-muted">▤ &nbsp; Invoice Masthead</div><div class="sim-tree-child sim-selected">▤ &nbsp; Billing Parties <small>4p</small></div><div class="sim-tree-child sim-muted">▤ &nbsp; Invoice Items</div></div><div class="sim-properties"><div class="sim-tabs"><span>HTML</span><span>CSS</span><span class="sim-active">{} Props</span><span>Config</span></div><div class="sim-prop-body"><small class="sim-label">SECTION</small><strong>Billing Parties</strong><div class="sim-prop-card"><div class="sim-prop-name"><b>fromLabel</b><small>Text <svg class="sim-chevron" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="m4 6 4 4 4-4" /></svg></small></div><div class="sim-prop-value"><small class="sim-label">VALUE</small><span class="sim-input sim-focus">FROM TEMBUILDER</span><div class="sim-embed">{{ props.fromLabel }}</div></div></div></div></div></div></div>
<figcaption>Structure → Props</figcaption>
</figure>

## 2. Try data and preview
Open **Parameters → Schema** to inspect field names and defaults. Keep names unchanged. **Layout** shows your current design edits.

**Save** the template before opening **PDF**. PDF preview uses saved template content and the editor’s parameter values, initially populated from Defaults. After saving another change, regenerate the PDF to see it; the previous preview does not update automatically. Preview does not consume render quota.

The inputs in **Run** are separate from PDF preview. To test new Run values, render and inspect that job’s result in steps 3–4.

<figure class="doc-sim" aria-label="Parameters shows the data structure. PDF preview shows the PDF layout.">
<div class="sim-location"><span>Editor / Parameters → PDF preview</span><span>TEMBUILDER</span></div>
<div class="sim-stage"><div class="sim-preview-layout"><div class="sim-data"><div class="sim-tabs"><span class="sim-active">Parameters <small>11</small></span></div><div class="sim-schema-tabs"><span>⚙ Schema</span><span>{} Payload</span></div><div class="sim-fields"><div><b>invoiceNumber</b><small>Text</small></div><span class="sim-input">TB-2026-0042</span><div><b>customer</b><small>Object</small></div><div class="sim-nested"><b>company</b><span class="sim-input">Tembuilder</span></div><div><b>lineItems</b><small>Array</small></div></div></div><div class="sim-preview"><div class="sim-tabs"><span>Layout</span><span class="sim-active">PDF</span></div><div class="sim-paper"><div class="sim-paper-brand">Tembuilder</div><div class="sim-invoice-title">INVOICE <small>TB-2026-0042</small></div><div class="sim-bill"><small>BILL TO</small><b>Tembuilder</b></div><div class="sim-paper-lines"><i></i><i></i><i></i></div><div class="sim-total"><small>TOTAL DUE</small><b>$597.20</b></div></div></div></div></div>
<figcaption>Parameters · Schema → PDF</figcaption>
</figure>

The [sample JSON](/docs/examples/invoice-data.json) uses `invoiceNumber`, `seller`, `customer` and `lineItems`, matching the ZIP above. For other templates, check their own Parameters. When calling the API, put the data object inside `parameters`.

## 3. Save, publish and generate
1. **Save** your changes, select the correct version and **publish** it.
2. Create a project API key with `template:render` permission if needed.
3. Open **Run**, select the key, version and variant, and enter data.
4. Click **Render** and wait for completion.

<figure class="doc-sim" aria-label="Save and publish the version → select a key, version and variant in Run → Render.">
<div class="sim-location"><span>Editor / Publish → Run</span><span>TEMBUILDER</span></div>
<div class="sim-stage"><div class="sim-publish-bar"><div><strong>My first invoice</strong><span class="sim-badge">v1</span></div><div class="sim-actions"><span class="sim-control">Save</span><span class="sim-control sim-dark sim-focus">Publish</span></div></div><div class="sim-run"><div class="sim-panel-title">ϟ &nbsp; RUN</div><div class="sim-run-body"><div class="sim-pickers"><div><small class="sim-label">API KEY</small><span class="sim-input">My project key <svg class="sim-chevron" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="m4 6 4 4 4-4" /></svg></span></div><div><small class="sim-label">VERSION</small><span class="sim-input">v1 <svg class="sim-chevron" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="m4 6 4 4 4-4" /></svg></span></div><div><small class="sim-label">VARIANT</small><span class="sim-input">Standard <svg class="sim-chevron" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="m4 6 4 4 4-4" /></svg></span></div></div><div class="sim-code"><span>{</span><span>  "invoiceNumber": "TB-2026-0042",</span><span>  "customer": {</span><span>    "company": "Tembuilder"</span><span>  }, …</span><span>}</span></div><div class="sim-render-footer"><span class="sim-badge sim-success">● Published</span><span class="sim-control sim-dark sim-focus">ϟ &nbsp; Render</span></div></div></div></div>
<figcaption>Publish → Run → Render</figcaption>
</figure>

> Real renders require a published version. Each successful render consumes quota; a working preview alone does not mean a template is ready to render.

## 4. Download and check
After success, open the result and download the PDF. You can also find the job in **Renders**. Check the first page, last page and data rows in the downloaded file.

<figure class="doc-sim" aria-label="Open a completed render to download the PDF. Find previous results in Renders.">
<div class="sim-location"><span>Run / History · Renders</span><span>TEMBUILDER</span></div>
<div class="sim-stage"><div class="sim-result"><div class="sim-result-top"><span class="sim-success-mark">✓</span><div><strong>My first invoice</strong><small>v1 · Standard</small></div><span class="sim-badge sim-success">Completed</span></div><div class="sim-result-file"><span class="sim-file">PDF</span><div><strong>invoice.pdf</strong><small>application/pdf</small></div><span class="sim-control sim-dark sim-focus">↓ &nbsp; Download</span></div></div></div>
<figcaption>Renders → Download</figcaption>
</figure>

If it fails, read the error details before retrying. Each Render click can create a new job. See [common errors](/docs/help/common-errors/) if you cannot identify the cause.
