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

**URL:** <https://www.dolibarr.org/forum/t/templates-invoice-quotes-etc-how-to/19461>\
**Category:** Using my Dolibarr\
**Created:** [August 27, 2020, 1:20am UTC](https://www.dolibarr.org/forum/t/templates-invoice-quotes-etc-how-to/19461 "2020-08-27T01:20:38Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![GRIFFCOMM](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/griffcomm/32/3462_2.png) [@GRIFFCOMM](https://www.dolibarr.org/forum/u/GRIFFCOMM)\
**Post date:** [August 27, 2020, 1:20am UTC](https://www.dolibarr.org/forum/t/templates-invoice-quotes-etc-how-to/19461/1 "2020-08-27T01:20:38Z")

</div>

Hi

Ive looked over the 2 wiki pages below:

ODT = [https://wiki.dolibarr.org/index.php/Create\_an\_ODT\_document\_template](https://wiki.dolibarr.org/index.php/Create_an_ODT_document_template)  
PDF = [https://wiki.dolibarr.org/index.php/Create\_a\_PDF\_document\_template](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](https://wiki.dolibarr.org/index.php?title=Module_Builder&action=edit&redlink=1) 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

---

<div class="post-metadata">

**Author:** ![ksar](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/ksar/32/514_2.png) [@ksar](https://www.dolibarr.org/forum/u/ksar)\
**Post date:** [August 27, 2020, 9:33am UTC](https://www.dolibarr.org/forum/t/templates-invoice-quotes-etc-how-to/19461/2 "2020-08-27T09:33:43Z")

</div>

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](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](https://wiki.dolibarr.org/index.php/Setup_Other)

---

<div class="post-metadata">

**Author:** ![cam.lafit](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/cam.lafit/32/2879_2.png) [@cam.lafit](https://www.dolibarr.org/forum/u/cam.lafit)\
**Post date:** [September 2, 2020, 7:09am UTC](https://www.dolibarr.org/forum/t/templates-invoice-quotes-etc-how-to/19461/3 "2020-09-02T07:09:00Z")

</div>

Hello

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

> <https://github.com/Dolibarr/dolibarr/blob/develop/scripts/odt2pdf/odt2pdf.sh#L39>

Used here without problem.

---

<div class="post-metadata">

**Author:** ![GRIFFCOMM](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/griffcomm/32/3462_2.png) [@GRIFFCOMM](https://www.dolibarr.org/forum/u/GRIFFCOMM)\
**Post date:** [September 3, 2020, 12:11am UTC](https://www.dolibarr.org/forum/t/templates-invoice-quotes-etc-how-to/19461/4 "2020-09-03T00:11:32Z")

</div>

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](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](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?

---

<div class="post-metadata">

**Author:** ![ksar](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/ksar/32/514_2.png) [@ksar](https://www.dolibarr.org/forum/u/ksar)\
**Post date:** [September 3, 2020, 8:47am UTC](https://www.dolibarr.org/forum/t/templates-invoice-quotes-etc-how-to/19461/5 "2020-09-03T08:47:54Z")

</div>

Hi,

> [@GRIFFCOMM](#):
>
> - What is all this PHP logic in the original templates there for?

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

> [@GRIFFCOMM](#):
>
> - Will i loose anything if i use the ODT file (as that clearly cant have any PHP logic in it)?

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

> [@GRIFFCOMM](#):
>
> - Would i be right that i cant just use something like FPDF designer ([https://codecanyon.net/item/fpdf-designer-wysiwyg-script-generator/22704900](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?

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

> [@GRIFFCOMM](#):
>
> - If i want to output something else like a design on a label printer, am i stuck with FPDF php system?

Yes

---

<div class="post-metadata">

**Author:** ![cam.lafit](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/cam.lafit/32/2879_2.png) [@cam.lafit](https://www.dolibarr.org/forum/u/cam.lafit)\
**Post date:** [September 3, 2020, 6:15pm UTC](https://www.dolibarr.org/forum/t/templates-invoice-quotes-etc-how-to/19461/6 "2020-09-03T18:15:06Z")

</div>

Hello

odt generator parse content.xml and replace all {tag} value ([https://wiki.dolibarr.org/index.php/Create\_an\_ODT\_document\_template](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](https://wiki.dolibarr.org/index.php/Create_an_ODT_document_template#Other_personalized_tags)

---

<div class="post-metadata">

**Author:** ![hedi](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/h/ee59a6/32.png) [@hedi](https://www.dolibarr.org/forum/u/hedi)\
**Post date:** [December 8, 2020, 11:15am UTC](https://www.dolibarr.org/forum/t/templates-invoice-quotes-etc-how-to/19461/7 "2020-12-08T11:15:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![cam.lafit](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/cam.lafit/32/2879_2.png) [@cam.lafit](https://www.dolibarr.org/forum/u/cam.lafit)\
**Post date:** [December 8, 2020, 11:56am UTC](https://www.dolibarr.org/forum/t/templates-invoice-quotes-etc-how-to/19461/8 "2020-12-08T11:56:46Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![uzair1](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/u/b2d939/32.png) [@uzair1](https://www.dolibarr.org/forum/u/uzair1)\
**Post date:** [August 4, 2022, 7:44pm UTC](https://www.dolibarr.org/forum/t/templates-invoice-quotes-etc-how-to/19461/9 "2022-08-04T19:44:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pcbleu](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/pcbleu/32/3120_2.png) [@pcbleu](https://www.dolibarr.org/forum/u/pcbleu)\
**Post date:** [August 5, 2022, 7:11am UTC](https://www.dolibarr.org/forum/t/templates-invoice-quotes-etc-how-to/19461/10 "2022-08-05T07:11:26Z")

</div>

Hello 🙂 and welcome

Here is [a link](https://wiki.dolibarr.org/index.php/Create_a_PDF_document_template) on howto add your own pdf template in Dolibarr

Good continuation
