Drupal Commerce Development- Using Commerce Billy PDF

One of our clients wanted us to generate order PDF on order payment completion. The requirement included customized PDF which includes store logo, watermark and dynamic header and footer based on site language.

We used Commerce Billy PDF module to accomplish this task. Commerce Billy is a lightweight approach for a billing system for Drupal Commerce (Billy = Billing Light). 

Commerce Billy PDf is a part of Commerce Billy module.

This module adds a new order state called “invoiced”. In this state, order gets its invoice PDF generated.

Here is how we did this.

Download and enable module.

Go to admin/commerce/config/billy-invoice and choose the settings that apply to your system. Open configuration options.

Billy Invoice Setting

The settings include following:

1- Invoice number generation method

Invoice number generation

This decides how invoice number should be generated. We have 3 options here:

  • Infinite (one single number, that is never reset, and incremented at each invoice generation): This means that invoice number will be a single number and will not be changed ever. Invoice id increases with each invoice.
  • Reset every year, with an id incremented at each invoice generation: This is a default option selected. Invoice numbers reset every year.
  • Reset every month, with an id incremented at each invoice generation: Invoice numbers reset every month.

2 – Pattern


This is the pattern for invoice number. This pattern MUST include {id} which is invoice number id. Pattern can be anything depending upon how you selected invoice generation method.

3 – Current invoice id

Current invoice id

The number from which invoicing should start. This needs to be higher than the previous number set.

4 – Automatically invoice orders on checkout completion.

Automatically invoice orders

Checking this will automatically move the order into “invoiced” state upon order completion and invoice PDF is generated. Make sure to clear cache once you change these settings.

One of our requirements was to generate invoice PDF only when the order payment is completed. Rules come handy in such scenarios.

We also needed to customise the invoice PDF that is being generated. Commerce billy PDF has a tpl file called “commerce_order–commerce_order–pdf.tpl.php”. You can copy this file to your theme and make required customisation.

The module works out of the box and PDFs are generated without any problem. PDF can include any discounts that an order might have.

Drupal Development Services is the best choice!! The resulting PDF looks something like this:Open configuration options.

Final PDF
Floating Icon 1Floating Icon 2