Your First Template
This guide walks you through creating your first template in TemplateTo. By the end, you'll have a working invoice template that you can customize and use with the API.
Step 1: Create a New Template
- Log in to TemplateTo
- Navigate to Templates in the sidebar
- Click + New Template
- Give your template a name (e.g., "My First Invoice")
- Click Create
You'll now see the template editor with a blank canvas.
Step 2: Add a Layout
Templates work best when you organize content with layout elements.
- Click Elements in the right panel
- Find the Layout section
- Drag a 1 Column layout onto the canvas
This creates a container for your content.
Step 3: Add a Header
Let's add a title to your invoice:
- From the Basic elements, drag a Header element into the column
- Click on the header text to edit it
- Type "INVOICE"
- Use the header toolbar to center the text
Step 4: Add Company Details
Add text for company information:
- Drag a Text element below the header
- Type your company details:
Step 5: Add Dynamic Variables
Now let's make the template dynamic by adding variables that will be replaced with real data.
- Add another Text element
- Type:
Invoice #: {{invoiceNumber}} - Add another line:
Date: {{date}} - Add another line:
Customer: {{customerName}}
The {{variableName}} syntax creates placeholders that will be filled with data when you generate the document.
Test Your Variables
- Click Data in the editor menu
- In the Template Data panel, enter test JSON:
- Click Preview to see your variables replaced with test data
Step 6: Add a Table for Line Items
Invoices need line items. Let's add a table:
- Drag a Table element onto the canvas
- Set up the header row with columns: Item, Quantity, Price, Total
- In the second row, click the row handle (left side) and click +
- Select Repeating Row
- Choose
lineItemsas the array to repeat
In each cell of the repeating row, add:
- Column 1:
{{_.item}} - Column 2:
{{_.quantity}} - Column 3:
{{_.price}} - Column 4:
{{_.total}}
The underscore _ represents the current item in the loop.
Update Your Test Data
Add line items to your test JSON:
{
"invoiceNumber": "INV-001",
"date": "2024-01-15",
"customerName": "John Smith",
"lineItems": [
{ "item": "Widget", "quantity": 2, "price": "$10.00", "total": "$20.00" },
{ "item": "Gadget", "quantity": 1, "price": "$25.00", "total": "$25.00" }
],
"grandTotal": "$45.00"
}
Step 7: Add a Total
- Add a Text element below the table
- Type:
Total: {{grandTotal}} - Style it with the Properties panel (make it bold, align right)
Step 8: Save and Preview
- Click Save in the top bar
- Click Preview to open the preview in a new tab
- Your invoice should display with all test data filled in
Step 9: Generate Your First Document
Now let's generate a real PDF:
- Click Generate in the top bar (or navigate to Code Builder)
- You'll see options for how to generate the document
- Enter your data or use the test data
- Click Generate PDF
- Download your finished invoice!
Video Tutorial
Want to see this process in action? Watch our video walkthrough:
Next Steps
Now that you've created your first template:
- Elements Reference - Learn about all available elements
- Variables & Data - Advanced variable techniques
- Template Settings - Configure page size, headers, footers
- PDF Generation - PDF-specific features
- REST API - Generate documents programmatically
Tips for Better Templates
- Plan your layout first - Sketch what you want before building
- Use test data - Add realistic test data to catch formatting issues
- Keep it simple - Start with basic elements, add complexity later
- Use Content Blocks - Create reusable pieces for headers/footers
- Test with edge cases - Try long text, missing data, many rows