Introduction: Why Customize PDF Templates in Dolibarr?
Dolibarr is an open-source ERP/CRM solution that enables businesses to efficiently manage various aspects of their operations, including invoicing, customer management, and more. One of Dolibarr’s strengths is its flexibility, particularly the ability to customize generated PDF documents such as invoices, quotes, purchase orders, and reports.
Customizing PDF templates not only ensures compliance with local legal and tax requirements but also helps reflect your company’s brand identity by incorporating logos, colors, and specific information. This article provides a detailed guide on how to customize your PDF templates in Dolibarr, helping you improve professional efficiency and enhance your credibility with clients.
1. Introduction to PDF Templates in Dolibarr
1.1 What is a PDF Template in Dolibarr?
A PDF template in Dolibarr is a preconfigured layout used to generate professional documents. These templates automatically produce PDF files based on the data stored in Dolibarr, such as client information, product details, billed amounts, and more.
1.2 Types of Customizable Documents
Dolibarr allows customization of several types of documents:
- Invoices
- Quotes
- Purchase Orders
- Delivery Notes
- Contracts
- Activity Reports
Customizing these documents ensures consistency and creates a visual identity for all your business interactions.
2. Setting General PDF Template Parameters
2.1 Accessing PDF Template Settings
- Log in to your Dolibarr instance using an administrator account.
- Navigate to Setup > Modules/Applications.
- Activate the module associated with the documents you want to customize, such as "Invoices" or "Quotes."
- Once the module is activated, click Configure, then go to PDF Templates.
2.2 Commonly Configurable Parameters
In the PDF template configuration section, you can adjust:
- Base Template: Choose from several predefined templates, such as "Einstein," "Crabe," or "Odin."
- Visual Options: Add a logo, modify colors, or select an orientation (portrait or landscape).
- Visible Fields: Select the information to display, such as VAT number, discounts, or comments.
3. Visual Customization of PDF Templates
3.1 Adding Your Logo
A well-placed logo enhances your brand recognition. Here’s how to add it:
- Go to Setup > Company/Organization.
- Upload your logo in the appropriate section (PNG or JPG format recommended).
- In the PDF template settings, ensure the "Display Logo" option is enabled.
3.2 Changing Colors
Dolibarr allows you to customize the colors of headers, borders, and tables:
- Access the PDF template settings.
- Choose hexadecimal color codes to match your brand identity.
- Test the changes by generating a sample PDF.
3.3 Adding Fonts
By default, Dolibarr uses standard fonts, but you can add custom fonts to strengthen your visual identity. To do this:
- Upload the font in TTF format to your Dolibarr system.
- Modify the PHP files of the template to include the new font (requires coding skills).
4. Customizing Fields and Information
4.1 Adding Legal Mentions
Legal mentions are mandatory in many countries. To add them:
- Go to Setup > Company/Organization.
- Fill in sections related to legal information, such as VAT number, trade register details, or bank account information.
- This information will automatically be included in generated documents.
4.2 Enabling or Disabling Fields
Dolibarr offers flexibility in the information displayed on your documents:
- In the PDF template configuration, check or uncheck the necessary fields (e.g., "Amount excluding taxes," "Discounts," "Payment method").
- Save the changes and test a PDF document to validate the layout.
4.3 Adding Custom Fields
If your specific needs are not covered by the default fields:
- Go to Setup > Modules/Applications > Third-party Modules.
- Activate the "Additional Attributes" module.
- Add custom fields, which will appear in your PDF templates.
5. Advanced PDF Template Customization
For advanced users, it is possible to directly modify the source files of PDF templates. This allows for even more detailed customization.
5.1 Accessing the Source Files
- Connect to your server via FTP or SSH.
- Navigate to the directory where Dolibarr is installed (typically
/htdocs
). - PDF template files are located in the core/modules folder of the corresponding module (e.g.,
/core/modules/facture/pdf
for invoices).
5.2 Editing PHP Files
Each PDF template is coded in PHP. Here are some elements you can modify:
- Table Layouts: Adjust column widths or text alignment.
- Adding Logos or Images: Insert images such as watermarks or stamps.
- Dynamic Fields: Include calculated information, such as totals in words.
Note: Always modify a copy of the original files to avoid compromising the system.
6. Testing and Validating Templates
After each modification, it is essential to test your templates to ensure they display correctly.
6.1 Generating a Test Document
- Create a sample invoice or quote in Dolibarr.
- Generate a PDF using the customized template.
- Verify alignments, colors, and displayed fields.
6.2 Troubleshooting Common Issues
- Logo not displaying: Ensure the image is in the correct format (PNG/JPG) and stored in the right directory.
- Missing Fields: Verify that the necessary data is entered in client or product records.
7. Tips for Successful Customization
7.1 Staying Compliant with Legal Requirements
- Include all mandatory information, such as legal mentions or terms and conditions of sale.
- Check local regulations to avoid penalties.
7.2 Maintaining a Consistent Visual Identity
- Use consistent colors, fonts, and logos across all your documents.
- This improves your brand image and reinforces recognition among your clients.
7.3 Backing Up Your Changes
- Before updating Dolibarr, back up your customized templates to avoid losing your work.
Conclusion
Customizing PDF templates in Dolibarr is an excellent way to optimize your processes and enhance your professional image. Whether it’s invoices, quotes, or purchase orders, a well-designed document reflects your company’s credibility and professionalism.
By following this guide, you’ll be able to configure your templates to meet your unique needs while complying with legal requirements.