From contracts and invoices to social media banners, leverage our the htmlTemplate option for swift document generation. The htmlTemplate uses Handlebars to render your HTML together with the provided templateData. See the PDF endpoint for all available options.

Example

This example generates an invoice PDF using Tailwind CSS.

import Doczilla from '@doczilla/node'

const doczilla = new Doczilla('<your token>')

const pdf = await doczilla.pdf.direct({
  page: {
    htmlTemplate: '<div>HTML template (See below for full HTML)</div>',
    templateData: {
      number: '2024.0001',
      date: '01-01-2024',
      dueDate: '14-01-2024',
      terms: 14,
      subtotal: '1050.39',
      tax: '0',
      total: '1050.39',
      debtor: {
        name: 'John Doe',
        address: 'Other fake street 3',
        city: 'Rotterdam',
        zipcode: '1234 BB'
      },
      lines: [
        {
          description: 'Tesla Truck',
          quantity: 1,
          rate: '550.49',
          amount: '550.49'
        },
        {
          description: 'Tesla Charging Station',
          quantity: 10,
          rate: '49.99',
          amount: '499.90'
        }
      ]
    }
  }
})

HTML

Output