Templates (invoice, quotes etc..), how to?

Hi

Ive looked over the 2 wiki pages below:

ODT = https://wiki.dolibarr.org/index.php/Create_an_ODT_document_template
PDF = https://wiki.dolibarr.org/index.php/Create_a_PDF_document_template

Clearly its way easier for me to create an ODT template, however after reading some posts here, it appears when documents are created with the use of an ODT template, it spits out the ODT document populated, i would like to have PDF, is there a module that can be installed or a setting changed to have the system internally created a PDF document from this ODT template that has data in it, so i receive a PDF invoice rather than an ODT file thats an invoice when an invoice is created?

We want to email invoices directly from the system, so the client has to receive a PDF document, I am looking over the PDF template details now, but theirs a learning curve to that.

I notice in the Wiki PDF template page it says " Just use the Module Builder from v12.0 to create your module.", this appears to be a tool to create the template, however the link doesnt seem to hold any tool to use.

Many Thanks

Hi,

There is a way to convert the ODT to PDF automatically, but I never done it before so not sure how to do.
You need to be on linux and to have :

  1. This script installed : https://github.com/Dolibarr/dolibarr/blob/develop/scripts/odt2pdf/odt2pdf.sh
  2. Java installed
  3. jodconverter installed
  4. Define the MAIN_ODT_AS_PDF variable https://wiki.dolibarr.org/index.php/Setup_Other

Hello

jodconverter is no more required with native option. In this case only office is required

Used here without problem.

Relating to this question…

I notice the native PDF templates appear to have WAY MORE than just PHP template information in them, theirs loads of logic going on, that clearly will not be in the ODT file, so that raises a few questions:

We would like the PDF file to have metadata as well, so i assume we would need to stick to using the FPDF PHP method, however this is still under investigation, with that in mind, would i be right that Ultimate PDF v11 (https://www.dolistore.com/en/home/1221-ultimatepdf-110.html?search_query=ultimate+pdf&results=163)only overlays some CSS on to the existing PDF already in the system, as we dont see any page layout editor…?

  • What is all this PHP logic in the original templates there for?
  • Will i loose anything if i use the ODT file (as that clearly cant have any PHP logic in it)?
  • Would i be right that i cant just use something like FPDF designer (https://codecanyon.net/item/fpdf-designer-wysiwyg-script-generator/22704900) to create templates as it appears much more than “just layout” is used in the original files?
  • If i want to output something else like a design on a label printer, am i stuck with FPDF php system?

Hi,

All the logic is there to manage the page layout and print all the data’s that is in the dolibarr object

ODT is easier to have personalized documents but has a lot of restrictions. It is depending of your requirement in term of customization.

No you can’t use FPDF designer, because FPDF doesn’t know the dolibarr objects.

Yes

Hello

odt generator parse content.xml and replace all {tag} value (https://wiki.dolibarr.org/index.php/Create_an_ODT_document_template) .

You can’t set directly php code in odt template but you can add personalized tags with substitutions as explained on https://wiki.dolibarr.org/index.php/Create_an_ODT_document_template#Other_personalized_tags

Hello,

I use the version of dolibarr 12 on windows 10 and I wanted to convert my odt documents to pdf, it is now possible to use the xnative function for conversion without the need to install java and jodconverter.
is that you please know how to adapt the function so that I can get a result for my conversions.

thank you

Hello

You must declare some constant in Dolibarr BO
MAIN_ODT_AS_PDF native
MAIN_DOL_SCRIPTS_ROOT /path/to/root/

Of course libreoffice must be installed on the server.

Hello

Can you please tell me how to add and use multiple invoice templates at the same time with dolibarr 15 on windows 11, so that clients would have different invoices. If its possible kindly guide me how to do it.

Thanks

Hello :slight_smile: and welcome

Here is a link on howto add your own pdf template in Dolibarr

Good continuation