Automate your PDF invoices

Imaging you’re a wholesale distributor. New and existing clients regularly call you up for quotes. You take their orders over the phone, draft up a quote, turn it into a PDF, and email it over to them. If they’re happy with the price, they email you back requesting an invoice. You draft up a new invoice, turn it into a PDF, and email it to them for payment.

This is a pretty slow process. Inputting the information into the quote and invoice takes up a lot of your time and it’s easy to make mistakes with the calculations. Why not build an app to solve this problem for you?

I’ll walk you through an app I built in just a few hours to automate this process, using nothing but Python.

Here’s how the app works:

Click here for a copy of the final app:

This app uses a number of the techniques covered in our news aggregator tutorial, which is a step-by-step guide to building a “CRUD” app, named after the Create, Read, Update and Delete operations.

For more general information on creating PDFs with Anvil, see here.

How the app works

We store the warehouse inventory of the wholesaler in Anvil’s Data Tables, a built-in database system built on top of PostgreSQL.

1. Select items

Clients enter the wholesaler’s online portal and select items from the product inventory.

2. View quote

Once they’re done with their selection, they can view a quote for the selected items.

3. Add client information

If they’re happy with the quote, they can add their details to receive a personalised invoice.

4. Generate PDF invoice

Once they’ve added their information, the invoice is displayed in the portal, and a PDF version is made available for download.

That’s the full process automated using nothing but Python! Anvil’s PDF support makes it simple to drag and drop your visual design, and render it in PDF format.

You can get a copy of the source code and design of the app by clicking here:

To learn more about building database-backed apps with Anvil, read our tutorial: