Table of Contents
-
Introduction
-
Understanding How Dolibarr Handles PDF Generation
-
The Temporary Nature of PDF Files in Dolibarr
-
Where Are PDFs Stored (and For How Long)?
-
Common Misconceptions About Document Saving
-
File Generation vs. File Storage in Dolibarr
-
Module Behavior: Invoices, Orders, Proposals, etc.
-
Configuration Settings That Affect PDF Handling
-
Permissions and Server Environment Considerations
-
What Happens When You Regenerate a PDF?
-
How to Automatically Save and Archive PDFs
-
Keeping Track of Generated PDFs for Legal or Audit Reasons
-
Using External File Repositories (Dropbox, Nextcloud, FTP)
-
Workaround: Copying PDF Files Automatically
-
Best Practices for Document Retention in Dolibarr
-
Avoiding Data Loss from Temporary Files
-
How Custom Modules Handle PDF Saving
-
Differences in Behavior Between Hosted and Self-Hosted Dolibarr
-
When to Ask for Developer Help
-
Conclusion: Managing PDF Files in Dolibarr with Confidence
1. Introduction
Dolibarr is a robust ERP and CRM solution designed for small and medium businesses. Among its many capabilities is the ability to generate PDF documents such as invoices, quotes, delivery notes, and more. However, one frequent question from new users is: "Why doesn’t Dolibarr save the PDF documents it generates by default?"
This article dives deep into the architecture, logic, and best practices around PDF document handling in Dolibarr. Understanding this will help you manage files better, avoid data loss, and tailor your system to fit your business needs.
2. Understanding How Dolibarr Handles PDF Generation
Dolibarr doesn't use pre-saved PDFs as default. Instead, it generates documents on demand. When a user clicks to view or download a PDF, Dolibarr creates the file dynamically using data from its database and a predefined template.
This approach ensures that:
-
The PDF reflects the most recent data
-
No disk space is wasted on outdated or unused files
-
Templates and layouts can be updated without needing to regenerate all existing files
3. The Temporary Nature of PDF Files in Dolibarr
By default, Dolibarr only saves PDF files temporarily. The system stores them in the /documents/
directory, often under a structure like /documents/facture/
, /documents/propal/
, or /documents/commande/
.
However, if the file already exists, Dolibarr might overwrite it unless configured otherwise. If you regenerate a document, Dolibarr recreates it with the latest data.
4. Where Are PDFs Stored (and For How Long)?
Dolibarr organizes files by module:
-
Invoices:
/documents/facture/REF/
-
Orders:
/documents/commande/REF/
-
Proposals:
/documents/propal/REF/
These folders contain PDFs if they were downloaded or explicitly generated. But if you never clicked to generate a PDF, it might not exist on disk.
PDFs remain saved unless manually deleted or if a system cleanup removes them. There’s no automatic expiry, but regenerating will overwrite unless file versioning is used.
5. Common Misconceptions About Document Saving
Users often assume:
-
PDFs are automatically saved after validation — they are not
-
All actions create files on the disk — only document generation does
-
PDFs are permanently stored — only if manually kept
Understanding that PDF generation is separate from storage is key to managing documents in Dolibarr.
6. File Generation vs. File Storage in Dolibarr
Here’s how Dolibarr typically works:
-
A document (e.g., invoice) is created and validated
-
No file is saved at this point
-
The user clicks “Generate PDF”
-
Dolibarr builds the file using the template and saves it to the relevant directory
-
The file remains until deleted or overwritten
This separation gives flexibility but requires awareness to avoid missing files later.
7. Module Behavior: Invoices, Orders, Proposals, etc.
Each module handles documents slightly differently:
-
Invoices: PDFs are created only when clicked; they can be regenerated any time
-
Orders: Same logic applies
-
Proposals: May include optional watermarking and status
It’s best practice to generate and save PDFs after validation to keep a record of the document at the time it was finalized.
8. Configuration Settings That Affect PDF Handling
You can configure some behaviors:
-
Go to Setup > Modules > PDF templates
-
Set default templates and enable auto-generation (in limited modules)
-
Use the document directory path settings under Setup > Other Setup if customizing file structure
These settings influence where and how PDFs are generated and stored.
9. Permissions and Server Environment Considerations
Dolibarr must have write permissions to the /documents/
folder. If permissions are misconfigured:
-
PDFs may not be saved
-
File generation may fail silently
Ensure that your Apache/Nginx user has correct access and that your server environment (especially in shared hosting) supports file writing.
10. What Happens When You Regenerate a PDF?
When you regenerate a document:
-
The old file is overwritten (if the filename is the same)
-
The content is updated to reflect current data
This is useful for correcting data but problematic if you needed to preserve the original version for legal or audit purposes.
11. How to Automatically Save and Archive PDFs
Options for auto-saving:
-
Use a cron job to trigger PDF generation after validation
-
Add a module or hook to auto-generate and lock PDFs
-
Move PDF files to an archive directory via script
This ensures every validated document is also preserved in its original state.
12. Keeping Track of Generated PDFs for Legal or Audit Reasons
To ensure audit readiness:
-
Generate PDFs at the moment of document validation
-
Move or copy the files to a read-only archive
-
Use versioning (e.g., invoice-2025-01-V1.pdf) to avoid overwrites
This is especially critical in countries with strict e-invoicing or VAT archiving requirements.
13. Using External File Repositories (Dropbox, Nextcloud, FTP)
Dolibarr can integrate with external storage:
-
Use modules to sync
/documents/
to cloud services -
Automate backup of PDF files to FTP or SFTP
-
Implement WebDAV or shared folders for team access
This enhances document security and availability.
14. Workaround: Copying PDF Files Automatically
Use a script (bash, Python, etc.) to monitor the /documents/
directory and:
-
Detect new files
-
Copy them to another location
-
Rename them for archiving
Set this script as a cron job to run hourly or daily.
15. Best Practices for Document Retention in Dolibarr
-
Always generate PDFs upon document validation
-
Use naming conventions for version tracking
-
Maintain a separate backup outside the Dolibarr server
-
Train users on when and how to generate PDFs
16. Avoiding Data Loss from Temporary Files
If a PDF was never generated or saved:
-
It can’t be retrieved from history
-
You’ll need to regenerate it — which may no longer reflect original data
Protect against this by enforcing generation policies at the time of document approval.
17. How Custom Modules Handle PDF Saving
Some Dolibarr extensions add auto-save or PDF logging features. These modules can:
-
Auto-generate PDFs on event triggers
-
Log when a PDF was created and by whom
-
Save backups to external systems
Choose reputable modules from Dolistore or work with a developer to add this capability.
18. Differences in Behavior Between Hosted and Self-Hosted Dolibarr
Hosted Dolibarr versions (e.g., SaaS providers):
-
May limit access to the filesystem
-
May auto-clean old files
-
Often require support ticket for bulk downloads
Self-hosted installations offer more control over document storage, scripting, and backups.
19. When to Ask for Developer Help
Contact a Dolibarr integrator if:
-
You need automatic archiving
-
You want to integrate cloud storage
-
You have audit-specific PDF versioning requirements
Custom scripts or modules can bridge these gaps effectively.
20. Conclusion: Managing PDF Files in Dolibarr with Confidence
Dolibarr’s approach to PDF generation favors flexibility and efficiency—but it puts the responsibility for saving and archiving documents on the user. Once you understand how PDFs are generated, where they’re stored, and how to control the process, you can ensure compliance, minimize data loss, and streamline your business workflows.
Whether through built-in tools, smart scripting, or external storage, Dolibarr offers everything you need to manage documents—if you know how to configure it right.