Skip to main content

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:

ApproachBest ForTime
AI GenerationQuick start, common use cases~1 minute
Template GalleryProfessional designs, inspiration~2 minutes
Manual DesignFull customization, unique layouts~10-15 minutes
info

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

  1. Log in to your RenderDoc Dashboard
  2. Go to TemplatesCreate Template
  3. 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

  1. AI generates a complete template with:
    • Professional layout and styling
    • Appropriate components
    • Pre-configured variables (e.g., {{customerName}}, {{invoiceNumber}})
  2. Review the generated template in the designer
  3. 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

  1. Click Preview to test the template
  2. Click Save to save your draft
  3. Click Publish to make it available for document generation
  4. Copy the Template ID for use in your code
info

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".


Browse and import professionally designed templates:

  1. Log in to your RenderDoc Dashboard
  2. Go to TemplatesTemplate 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

  1. Click on a template to preview it
  2. Review the included variables and structure
  3. Click Import to add it to your templates

Step 4: Customize

  1. The template opens in the designer
  2. Update the branding:
    • Replace the logo
    • Adjust colors to match your brand
    • Update company information
  3. Modify content as needed
  4. Add or remove sections

Step 5: Publish

  1. Click Preview to test
  2. Click Save and Publish
  3. 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

  1. Log in to your RenderDoc Dashboard
  2. Click Templates in the sidebar
  3. Click the Create Template button
  4. 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:

  1. Click the Settings icon (gear) in the top toolbar
  2. 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

Step 3: Add a Header Section

Let's start with a branded header:

  1. From the Component Library (left panel), drag a Container onto the canvas

  2. With the container selected, set these properties in the right panel:

    • Background Color: #1a1a2e (dark blue)
    • Padding: 24px
  3. Drag an Image component into the container

  4. Click Select from Gallery (or enter your logo URL)

  5. Set image properties:

    • Width: 150px
    • Alignment: Left
    • Alt Text: Company Logo
  6. Drag a Heading component beside the logo

  7. Set heading properties:

    • Content: INVOICE
    • Level: H1
    • Text Color: #ffffff
    • Text Align: Right

Step 4: Add Invoice Details

Now add the invoice information section:

  1. Drag a new Container below the header

  2. Set container properties:

    • Background Color: #ffffff
    • Padding: 32px
  3. Add a Columns component (2 columns)

  4. In the left column, add Text components:

    • Content: Invoice #: {{invoiceNumber}}
    • Content: Date: {{invoiceDate}}
    • Content: Due Date: {{dueDate}}
  5. In the right column, add the customer info:

    • Heading: Bill To
    • Text: {{customerName}}
    • Text: {{customerAddress}}
    • Text: {{customerEmail}}

Step 5: Add Line Items with Loop

For dynamic line items, use a Loop component:

  1. Drag a Table component into the content area

  2. Configure table headers: Description | Quantity | Unit Price | Amount

  3. For the table body, use a Loop component:

    • Data Source: {{items}}
  4. Inside the loop, add table cells:

    • Description: {{item.description}}
    • Quantity: {{item.quantity}}
    • Unit Price: {{item.unitPrice}}
    • Amount: {{item.amount}}
info

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:

  1. Add a Container for totals (right-aligned)

  2. 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)

Create a professional footer:

  1. Drag a new Container for the footer

  2. Set properties:

    • Background Color: #f8f9fa
    • Padding: 24px
    • Text Align: Center
  3. Add Text component:

    • Content: Thank you for your business!
    • Font Size: 14px
  4. Add payment terms:

    • Content: {{paymentTerms}}
    • Font Size: 12px
    • Text Color: #666666

Step 8: Review Variables

Click the Variables tab in the right panel to see all detected variables:

VariableTypeDescription
invoiceNumberStringInvoice identifier
invoiceDateStringDate of invoice
dueDateStringPayment due date
customerNameStringCustomer's name
customerAddressStringCustomer's address
customerEmailStringCustomer's email
itemsArrayLine items
subtotalStringOrder subtotal
taxRateNumberTax percentage
taxAmountStringTax amount
totalStringTotal due
paymentTermsStringPayment terms

Step 9: Preview Your Template

Test how your template looks:

  1. Click the Preview button in the toolbar
  2. Click Test Data to enter sample values
  3. 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

  1. Click Save to save your draft
  2. Click Publish to make the template available for document generation
warning

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.

  1. Copy your Template ID for use in your code:
    • UUID: 550e8400-e29b-41d4-a716-446655440000
    • Slug: invoice-template

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

ComponentUse CaseKey Properties
TextParagraphs, descriptionscontent, fontSize, color, align
HeadingTitles, section headerscontent, level (H1 to H6), color
ImageLogos, product imagessrc, alt, width, alignment
ContainerGroup components, backgroundsbackgroundColor, padding, borderRadius
ColumnsSide-by-side layoutscolumnCount (2 to 4), gap
TableStructured data, line itemsheaders, rows, styling
DividerVisual separationcolor, thickness, margin
LoopRepeat for arraysdataSource, itemVariable
ConditionalShow/hide contentcondition

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

  1. Keep it professional - Clean layouts with clear hierarchy
  2. Consistent spacing - Use uniform padding and margins
  3. Brand colors - Stick to 2-3 primary colors
  4. Readable fonts - 10-12pt for body text, 14-18pt for headings
  5. Page awareness - Design for A4/Letter page sizes

Variables

  1. Descriptive names - Use customerFirstName not fn
  2. Provide defaults - Handle missing variables gracefully
  3. Test thoroughly - Preview with sample data before publishing
  4. Document variables - Keep a list of required variables

PDF Best Practices

  1. Use web-safe fonts - Arial, Helvetica, Georgia, Times New Roman
  2. Set proper margins - 40-60px for printing
  3. Include page numbers - For multi-page documents
  4. Test printing - Verify layout when printed

Troubleshooting

Template Not Saving

Solutions:

  1. ✅ Check for validation errors in components
  2. ✅ Ensure all required fields are filled
  3. ✅ Check your internet connection
  4. ✅ Try refreshing and re-saving

Variables Not Rendering

Solutions:

  1. ✅ Verify syntax: {{variableName}} with double curly braces
  2. ✅ Check variable names are exact (case-sensitive)
  3. ✅ Ensure the variable is passed when generating
  4. ✅ Check the Variables tab for detected variables

Layout Issues in PDF

Solutions:

  1. ✅ Use fixed widths for columns in tables
  2. ✅ Avoid very long unbroken text
  3. ✅ Test with maximum expected data length
  4. ✅ Preview before publishing

Images Not Displaying

Solutions:

  1. ✅ Use HTTPS URLs for external images
  2. ✅ Upload images to Asset Gallery for best results
  3. ✅ Include alt text for broken image fallback
  4. ✅ 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: