Create a Document Template
Build a professional, reusable template for generating PDF and Excel documents.
Overview
This tutorial guides you through creating a professional document template. You'll learn:
- How to quickly generate templates using AI
- How to import pre-built templates from the Template Gallery
- How to manually build templates with the drag-and-drop designer
- Working with dynamic variables for personalization
- Preview and publish your template
By the end, you'll have a reusable invoice template that you can use to generate documents via the API.
Prerequisites
Before starting, make sure you have:
- An active RenderDoc account
- Access to the dashboard
- (Optional) A logo or images for your template
Choose Your Approach
RenderDoc offers three ways to create templates. Choose the one that works best for you:
| Approach | Best For | Time |
|---|---|---|
| AI Generation | Quick start, common use cases | ~1 minute |
| Template Gallery | Professional designs, inspiration | ~2 minutes |
| Manual Design | Full customization, unique layouts | ~10-15 minutes |
Recommendation: Start with AI generation or the Template Gallery to get up and running quickly. You can always customize the result afterward.
Option A: Generate with AI (Fastest)
Let AI create your template in seconds:
Step 1: Start AI Generation
- Log in to your RenderDoc Dashboard
- Go to Templates → Create Template
- Click Generate with AI
Step 2: Describe Your Template
Enter a natural language description of what you need. Be specific for better results:
Example prompts:
"Professional invoice with company logo header, invoice number, date, bill-to section, line items table with quantity and prices, subtotal, tax, and total. Include payment terms at the bottom."
"Monthly sales report with company branding, summary statistics, sales by region table, monthly trend chart, and detailed transaction list"
"Certificate of completion with elegant border, recipient name, course title, completion date, and signature line"
Step 3: Review and Customize
- AI generates a complete template with:
- Professional layout and styling
- Appropriate components
- Pre-configured variables (e.g.,
{{customerName}},{{invoiceNumber}})
- Review the generated template in the designer
- Make any adjustments:
- Update colors to match your brand
- Replace placeholder logo with your own
- Modify text content
- Add or remove sections
Step 4: Publish
- Click Preview to test the template
- Click Save to save your draft
- Click Publish to make it available for document generation
- Copy the Template ID for use in your code
Pro tip: You can continue to refine the template with AI. Just describe the changes you want: "Add a footer with page numbers" or "Make the header background blue".
Option B: Import from Template Gallery
Browse and import professionally designed templates:
Step 1: Open the Template Gallery
- Log in to your RenderDoc Dashboard
- Go to Templates → Template Gallery
Step 2: Find a Template
Browse by category:
- Invoices: Professional invoices, receipts, quotes
- Reports: Business reports, analytics, summaries
- Certificates: Achievements, completions, awards
- Contracts: Agreements, proposals, NDAs
Or search for specific templates like "invoice", "report", or "certificate".
Step 3: Preview and Import
- Click on a template to preview it
- Review the included variables and structure
- Click Import to add it to your templates
Step 4: Customize
- The template opens in the designer
- Update the branding:
- Replace the logo
- Adjust colors to match your brand
- Update company information
- Modify content as needed
- Add or remove sections
Step 5: Publish
- Click Preview to test
- Click Save and Publish
- Copy the Template ID
Option C: Build Manually (Full Control)
For complete customization, build your template from scratch using the drag-and-drop designer.
Tutorial: Create an Invoice Template
Step 1: Navigate to Templates
- Log in to your RenderDoc Dashboard
- Click Templates in the sidebar
- Click the Create Template button
- Select PDF Template
You'll be taken to the template designer with a blank canvas.
Step 2: Set Template Details
Before designing, set the basic template information:
- Click the Settings icon (gear) in the top toolbar
- Fill in the template details:
- Name:
Invoice Template - Slug:
invoice-template(auto-generated, used in API) - Description:
Professional invoice for customers - Page Size: A4 or Letter
- Name:
Step 3: Add a Header Section
Let's start with a branded header:
-
From the Component Library (left panel), drag a Container onto the canvas
-
With the container selected, set these properties in the right panel:
- Background Color:
#1a1a2e(dark blue) - Padding:
24px
- Background Color:
-
Drag an Image component into the container
-
Click Select from Gallery (or enter your logo URL)
-
Set image properties:
- Width:
150px - Alignment:
Left - Alt Text:
Company Logo
- Width:
-
Drag a Heading component beside the logo
-
Set heading properties:
- Content:
INVOICE - Level:
H1 - Text Color:
#ffffff - Text Align:
Right
- Content:
Step 4: Add Invoice Details
Now add the invoice information section:
-
Drag a new Container below the header
-
Set container properties:
- Background Color:
#ffffff - Padding:
32px
- Background Color:
-
Add a Columns component (2 columns)
-
In the left column, add Text components:
- Content:
Invoice #: {{invoiceNumber}} - Content:
Date: {{invoiceDate}} - Content:
Due Date: {{dueDate}}
- Content:
-
In the right column, add the customer info:
- Heading:
Bill To - Text:
{{customerName}} - Text:
{{customerAddress}} - Text:
{{customerEmail}}
- Heading:
Step 5: Add Line Items with Loop
For dynamic line items, use a Loop component:
-
Drag a Table component into the content area
-
Configure table headers: Description | Quantity | Unit Price | Amount
-
For the table body, use a Loop component:
- Data Source:
{{items}}
- Data Source:
-
Inside the loop, add table cells:
- Description:
{{item.description}} - Quantity:
{{item.quantity}} - Unit Price:
{{item.unitPrice}} - Amount:
{{item.amount}}
- Description:
Loop Variables: Inside a loop, access item properties with {{item.propertyName}}. The item prefix is automatically added.
Step 6: Add Totals Section
Below the items table:
-
Add a Container for totals (right-aligned)
-
Add rows using Columns (2 columns):
Subtotal Row:
- Left:
Subtotal: - Right:
{{subtotal}}
Tax Row:
- Left:
Tax ({{taxRate}}%): - Right:
{{taxAmount}}
Total Row:
- Left:
Total Due:(bold, larger) - Right:
{{total}}(bold, larger)
- Left:
Step 7: Add Footer
Create a professional footer:
-
Drag a new Container for the footer
-
Set properties:
- Background Color:
#f8f9fa - Padding:
24px - Text Align:
Center
- Background Color:
-
Add Text component:
- Content:
Thank you for your business! - Font Size:
14px
- Content:
-
Add payment terms:
- Content:
{{paymentTerms}} - Font Size:
12px - Text Color:
#666666
- Content:
Step 8: Review Variables
Click the Variables tab in the right panel to see all detected variables:
| Variable | Type | Description |
|---|---|---|
invoiceNumber | String | Invoice identifier |
invoiceDate | String | Date of invoice |
dueDate | String | Payment due date |
customerName | String | Customer's name |
customerAddress | String | Customer's address |
customerEmail | String | Customer's email |
items | Array | Line items |
subtotal | String | Order subtotal |
taxRate | Number | Tax percentage |
taxAmount | String | Tax amount |
total | String | Total due |
paymentTerms | String | Payment terms |
Step 9: Preview Your Template
Test how your template looks:
- Click the Preview button in the toolbar
- Click Test Data to enter sample values
- Verify all variables render correctly
Example test data:
{
"invoiceNumber": "INV-2025-001",
"invoiceDate": "December 29, 2025",
"dueDate": "January 13, 2026",
"customerName": "Acme Corporation",
"customerAddress": "123 Business St, New York, NY 10001",
"customerEmail": "[email protected]",
"items": [
{ "description": "Consulting Services", "quantity": 10, "unitPrice": "$150.00", "amount": "$1,500.00" },
{ "description": "Software License", "quantity": 1, "unitPrice": "$500.00", "amount": "$500.00" }
],
"subtotal": "$2,000.00",
"taxRate": 8.5,
"taxAmount": "$170.00",
"total": "$2,170.00",
"paymentTerms": "Payment due within 14 days. Bank transfer to Account #1234567890."
}
Step 10: Save and Publish
- Click Save to save your draft
- Click Publish to make the template available for document generation
Draft vs Published: Only published templates can be used to generate documents via API. You can continue editing a published template - changes won't affect existing documents until you publish again.
- Copy your Template ID for use in your code:
- UUID:
550e8400-e29b-41d4-a716-446655440000 - Slug:
invoice-template
- UUID:
Using Your Template
Now generate documents using your new template:
const response = await fetch('https://api.renderdoc.dev/api/v1/documents/generate', {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
templateId: 'invoice-template', // or use the UUID
format: 'pdf',
variables: {
invoiceNumber: 'INV-2025-001',
invoiceDate: 'December 29, 2025',
dueDate: 'January 13, 2026',
customerName: 'Acme Corporation',
customerAddress: '123 Business St, New York, NY 10001',
customerEmail: '[email protected]',
items: [
{ description: 'Consulting Services', quantity: 10, unitPrice: '$150.00', amount: '$1,500.00' },
{ description: 'Software License', quantity: 1, unitPrice: '$500.00', amount: '$500.00' }
],
subtotal: '$2,000.00',
taxRate: 8.5,
taxAmount: '$170.00',
total: '$2,170.00',
paymentTerms: 'Payment due within 14 days.'
}
}),
});
const data = await response.json();
console.log('Download URL:', data.downloadUrl);
Component Reference
Commonly Used Components
| Component | Use Case | Key Properties |
|---|---|---|
| Text | Paragraphs, descriptions | content, fontSize, color, align |
| Heading | Titles, section headers | content, level (H1 to H6), color |
| Image | Logos, product images | src, alt, width, alignment |
| Container | Group components, backgrounds | backgroundColor, padding, borderRadius |
| Columns | Side-by-side layouts | columnCount (2 to 4), gap |
| Table | Structured data, line items | headers, rows, styling |
| Divider | Visual separation | color, thickness, margin |
| Loop | Repeat for arrays | dataSource, itemVariable |
| Conditional | Show/hide content | condition |
Layout Tips
Two-Column Layout Example:
Columns (2 columns)
├── Column 1
│ └── Image (company logo)
└── Column 2
├── Heading (document title)
└── Text (document details)
Card Pattern:
Container (background, padding, border-radius)
├── Heading
├── Text
└── Table
Best Practices
Design
- Keep it professional - Clean layouts with clear hierarchy
- Consistent spacing - Use uniform padding and margins
- Brand colors - Stick to 2-3 primary colors
- Readable fonts - 10-12pt for body text, 14-18pt for headings
- Page awareness - Design for A4/Letter page sizes
Variables
- Descriptive names - Use
customerFirstNamenotfn - Provide defaults - Handle missing variables gracefully
- Test thoroughly - Preview with sample data before publishing
- Document variables - Keep a list of required variables
PDF Best Practices
- Use web-safe fonts - Arial, Helvetica, Georgia, Times New Roman
- Set proper margins - 40-60px for printing
- Include page numbers - For multi-page documents
- Test printing - Verify layout when printed
Troubleshooting
Template Not Saving
Solutions:
- ✅ Check for validation errors in components
- ✅ Ensure all required fields are filled
- ✅ Check your internet connection
- ✅ Try refreshing and re-saving
Variables Not Rendering
Solutions:
- ✅ Verify syntax:
{{variableName}}with double curly braces - ✅ Check variable names are exact (case-sensitive)
- ✅ Ensure the variable is passed when generating
- ✅ Check the Variables tab for detected variables
Layout Issues in PDF
Solutions:
- ✅ Use fixed widths for columns in tables
- ✅ Avoid very long unbroken text
- ✅ Test with maximum expected data length
- ✅ Preview before publishing
Images Not Displaying
Solutions:
- ✅ Use HTTPS URLs for external images
- ✅ Upload images to Asset Gallery for best results
- ✅ Include alt text for broken image fallback
- ✅ Keep image file sizes small (under 1MB)
Template Ideas
Looking for inspiration? Here are common template types:
Business Documents
- Invoices and receipts
- Quotes and proposals
- Contracts and agreements
- Purchase orders
Reports
- Monthly sales reports
- Financial statements
- Analytics summaries
- Project status reports
Certificates
- Course completion
- Achievement awards
- Membership cards
- Event tickets
Next Steps
Now that you've created your first template:
- Generate Your First Document - Use your template to generate documents
- Batch Generation - Generate multiple documents at once
- AI Template Generation - Let AI create templates for you
- Excel Reports - Create Excel spreadsheet templates