Text on footer invoices easily

Hello,

I searched, but I didn’t find anything, so here is a little code that will help you easily add a footer to your invoice.

You must create a “pied_de_page.txt” file in the main Dolibarr folder.

Edit this file: /core/lib/pdf.lib.php

Find this line:

// Show page nb only on iso languages (so default Helvetica font)

Just above, add this code:

$largeurDisponible = $dims['wk'] - $dims['lm'] - $dims['rm'];

// Vous pouvez changer le nom du fichier ici
$cheminFichier = DOL_DOCUMENT_ROOT.'/pied_de_page.txt'; 

if (file_exists($cheminFichier)) {
    $textePersonnalise = file_get_contents($cheminFichier);
} else {
    $textePersonnalise = "Le fichier pied_de_page.txt n'est pas trouvé.";
}

$pdf->SetXY($dims['lm'], -$posy - getDolGlobalInt('PDF_FOOTER_PAGE_NUMBER_Y', 0));

$pdf->MultiCell($largeurDisponible, 10, $textePersonnalise, 0, 'C', 0);

When you add text in txt file. Line changes will also be reproduced on the footer.

I hope this helped, if you want to improve, don’t hesitate.

cool, do you have a picture with and without your footer?

Maybe also submit a pull request here GitHub - Dolibarr/dolibarr: Dolibarr ERP CRM is a modern software package to manage your company or foundation's activity (contacts, suppliers, invoices, orders, stocks, agenda, accounting, ...). it's an open source Web application (written in PHP) designed for businesses of any sizes, foundations and freelancers.

This allows you to put text which will remain at the very bottom of the invoice and will not be superimposed if the invoice is very long.

I can’t put files (new user), so here is a link with the 2 images in Google drive

https://drive.google.com/drive/folders/1xaXEF_QT2Hs-bFmfRDf4-jdZywCsxDWJ?usp=sharing

Text is in French so I can’t read it.

no-footer.jpg

with footer.jpg

I can’t use it as I already use the built in footer function that you can see in this picture:

:flushed: where is this function?

I hope someone else can answer that question, because I can not find it right now :frowning:

The code responsible for the footer is in core/lib/pdf.lib.php, in function pdf_pagefoot(). An easy way to change the footer is to copy one of the existing pdf-modules and change the function _pagefoot() in the bottom of the file. There is the call into pdf_pagefoot() so it’s easy to overload it that way.