Invoice Automation

Generate PDF Invoices with Carbone

Download Template

Download data sample

  • Template type document docx simple
  • Carbone min. v5.0.0+
  • Features bidirectional loop set subtotal color
  • Target invoice contract custom custom

Objectives

You want to generate invoices with the following features:

  • Repeat the table header when a page breaks.
  • Automatically calculate the total of all products.
  • Add a page number at the bottom of each page.
  • Apply a dynamic color theme.

Solution

Here’s how you can achieve this using Carbone:

  1. Pagination

    Insert Carbone tags as appropriately as possible. Manage the font and formatting to organize your information as desired.

    Example : {d.company.name} {d.company.address} {d.company.postalCode} {d.company.city}

    Insert a placeholder image for your logo, and set its URL using the "View Alt Text..." option.

  2. Main Table

    Insert a table to display your products and references (e.g., prices, quantities, etc.) in columns. If certain values are not stored in your data, you can calculate them—for example, compute a subtotal by multiplying the product price by the quantity, with the formatter :mul()

    Add a row to specify the iteration with the formula : {d.products[i+1]}

Note: In the table properties, set the text wrapping to "None." Uncheck "Allow row to break across pages" to maintain consistency.

  1. Repeat Table Header on Page Break

    Highlight the first line of your main array, right-click, and open the "Table Properties" menu. Navigate to the "Row" tab and check the option "Repeat as header row at the top of each page."

  2. Calculate the Total of All Products

    Add another table to display your invoice total. Use the appropriate formatter :aggSum to compute the sum of all values, and apply the currency formatter :formatC to present the result.

    {d.products[].priceTotal:aggSum:formatC}

  1. Add Page Numbers

    Set the page number in the footer of the template.

  1. Apply a Dynamic Color Theme

    Use the following formula to change the text color of a paragraph (e.g., the title of your invoice): {d.color:color(p)}

    Use the following formula to change the background color of a row (e.g., the first row of the main table): `{d.color:color(row, background)}``

And there you go!

Alternatives

You might also like

Trusted by 600+ paid customers in 40+ countries

Finance
Healthcare
Public
Retail
Industries
Energy
Software
Telecom
1dior.png
22thales.png
23younited.png
2danfoss.png
3cma-cgm.png
3illumina.svg
4KparK.png
6scalingo.png
7defense.png
8bmw.png
8telus.png
bestseller.png
flagship_bioscience.png
insly.png
ninox.png
sodexo.png