4 alternative invoice pdf templates

Sending my thanks to all the Dolibarr developers I want to share 4 alternative invoice pdf templates.

As this forum won’t let me upload php files or archives, I share the github URL of my pull request where you can find the 4 templates and can copy them to your server, (click on the grey link 'github.com/Dolibarr/dolibarr.’ from below, not on the blue link):

Apart from some visual improvements, I reordered the columns, setting them in the most commonly used order: Product Description, Quantity, Unit Price, Taxes, Total Excluding Taxes.


Two of the templates also include an additional column: taxes amount per line, which is expected in some countries:

Two of the templates, the ones ending in ‘wt’ (which stands for ‘without table’), have a more modern look, as they only include the horizontal lines, which are enough to display a clear list of products and prices. This design is also adopted by many other well-known ERP applications:

All the templates also contain the following commented lines:

// Add background image
//$pdf->Image(DOL_DOCUMENT_ROOT.'/core/modules/facture/doc/background1.png', 26, 90, 160, 110);
//$pdf->Image(DOL_DOCUMENT_ROOT.'/core/modules/facture/doc/background2.png', 56, 100, 100, 100);

If you uncomment one of the lines, you can add an image as background for the table of prices, as can be seen in the examples below. This can be useful if someone wants to include a highly transparent version of their logo or of a pattern, as background for the invoice, in order to personalize it. (The two png images are free for commercial use without attribution, as they are taken from pixabay.com).

The two sample backgrounds:

The column headers: ‘Quantity’, ‘Unit Price’, ‘Taxes’, ‘Taxes Amount’, ‘Total Excl. Tax’ are handwritten in the pdf template, so, if someone needs them in French/German, etc. the easiest way is to replace them with their French/German translation, directly in the pdf templates.

To use all the templates you have to place them in ‘dolibarr_root_directory/core/modules/facture/doc’. Then don’t forget to go to Home > Setup > Modules/Applications > Invoices > click on the Setup wheel, then activate all the 4 pdf templates using the switch in the Status column, under ‘Invoice documents models’.

I couldn’t list all the images in one post. Since I’m a new user, the forum won’t let me.


Thanks so much for this :slight_smile:


Thanks for that !
Can you put htem here in .zip ?

No, this forum won’t let me post any type of archive here. I posted them as a zip archive at the bottom of the pull request thread. You can download the zip from there:

Replace the background images with any image that you like after you make it highly transparent (about 10% opacity). Both the pdf templates and the background images have to be placed in the ‘dolibarr_root_directory/core/modules/facture/doc’ directory, then you have to enable each template in ‘Home > Setup > Modules/Applications > Invoices > Setup’. Afterwards, you can just select the templates on the invoice card, instead of selecting the default ‘crabe’ template, when generating the pdf invoice.



Normally zip are allowed in the forum.

pdf_templates.zip (765.8 KB)

No, new users like me are not allowed to upload zip archives or other types of archives.
I’ve just tried again to upload a zip archive and I received:
‘Sorry, new users can not upload attachments.’


Yes sorry, when you are below 10 messages…
I have updated your profil, you should be able now

1 Like

This really Helps. thank you

How to change the order of these column headers to lets say: Description, Unit Price, Quantity, VAT, Total?

The instructions from below have been tested with Dolibarr 12.0.3 and they probably work for older Dolibarr versions too. They haven’t been tested with the latest version of Dolibarr, since I haven’t installed it yet.

If you want to change the order of columns, so as to have: Description, Unit Price, Quantity, Taxes, Total Excl. Tax, first copy the file pdf_anaxagoras.modules.php from the pdf_templaces.zip archive mentioned above, to the core/modules/facture/doc directory of your Dolibarr installation. Then, to be able to see the ‘anaxagoras’ template in the ‘Doc template’ drop-down list on an invoice and select it to generate the invoice based on that template, first go to Home > Setup > Modules/Applications > List view, then under ‘Financial Modules’, click the Setup wheel on the Invoices row. Then, under ‘Invoice documents models’ you will find the new pdf invoice template, ‘anaxagoras’. Enable it by turning on the Status switch. Next, go to Billing > Customer Invoices > List, and click on an invoice that you want to generate. If you scroll down to the ‘Doc template’ drop-down list, you will see the new ‘anaxagoras’ template in the list and you will be able to select it to generate the pdf invoice.

Now, to place the Unit Price column before the Quantity column, open the core/modules/facture/doc/pdf_anaxagoras.modules.php file and make the following changes:

Search for the following lines:


replace them with the following lines:


Then replace the following lines:


with these lines:


Next, search for this line:

pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxqty - $curX - $progress_width, 3, $curX, $curY, $hideref, $hidedesc);

and replace it with this:

pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxup - $curX - $progress_width, 3, $curX, $curY, $hideref, $hidedesc);

Then, search for this:

pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxqty - $curX - $progress_width, 3, $curX, $curY, $hideref, $hidedesc);

and replace it with this:

pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxup - $curX - $progress_width, 3, $curX, $curY, $hideref, $hidedesc);

Next, search for this:

$pdf->MultiCell($this->posxup - $this->posxqty - 0.8, 4, $qty, 0, 'R'); // Enough for 6 chars

and replace it with this:

$pdf->MultiCell($this->posxtva - $this->posxqty - 0.8, 4, $qty, 0, 'R'); // Enough for 6 chars

Then search for:

$pdf->MultiCell($this->posxtva - $this->posxup - 1, 3, $up_excl_tax, 0, 'R', 0);

and replace it with:

$pdf->MultiCell($this->posxqty - $this->posxup - 1, 3, $up_excl_tax, 0, 'R', 0);

Next, search for:

$pdf->MultiCell($this->posxup-$this->posxqty, 2, $outputlangs->transnoentities("Quantity"), '', 'C');

and replace it with:

$pdf->MultiCell($this->posxtva-$this->posxqty, 2, $outputlangs->transnoentities("Quantity"), '', 'C');

and finally, search for:

$pdf->MultiCell($this->posxtva-$this->posxup-0.5, 2, $outputlangs->transnoentities("Unit Price"), '', 'C');

and replace it with:

$pdf->MultiCell($this->posxqty-$this->posxup-0.5, 2, $outputlangs->transnoentities("Unit Price"), '', 'C');

The end result will look like this:

If you want to change the text of the column headers, just search for them and replace them manually. For example, to change ‘Taxes’ to ‘VAT’, search for this line:

$pdf->MultiCell($this->posxdiscount-$this->posxtva+4.5, 2, $outputlangs->transnoentities("Taxes"), '', 'C');

and change it to this:

$pdf->MultiCell($this->posxdiscount-$this->posxtva+4.5, 2, $outputlangs->transnoentities("VAT"), '', 'C');
1 Like

Thanks for the solution, it works :slight_smile: