# ODT 2 PDF

**URL:** <https://www.dolibarr.org/forum/t/odt-2-pdf/17414>\
**Category:** Using my Dolibarr\
**Created:** [March 7, 2019, 12:59pm UTC](https://www.dolibarr.org/forum/t/odt-2-pdf/17414 "2019-03-07T12:59:00Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![h6585](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/h/5f8ce5/32.png) [@h6585](https://www.dolibarr.org/forum/u/h6585)\
**Post date:** [March 7, 2019, 12:59pm UTC](https://www.dolibarr.org/forum/t/odt-2-pdf/17414/1 "2019-03-07T12:59:00Z")

</div>

Hi,

How do you convert an odt to pdf.

I have made a custom ODT for my invoice however the document that gets generated is in the ODT format and not in PDF format.

How do I get the pdf format?

Also, what is the font that is used in carbe pdf generation?

---

<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:** [March 7, 2019, 3:10pm UTC](https://www.dolibarr.org/forum/t/odt-2-pdf/17414/2 "2019-03-07T15:10:31Z")

</div>

Hi,

If you want to convert odt to pdf, you need to activate the odt2pdf script  
I do not find a tuto in english but you have some infos in here [SOLVED: ODT to PDF](http://www.dolibarr.org/forum/t/solved-odt-to-pdf/16931/1)

---

<div class="post-metadata">

**Author:** ![h6585](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/h/5f8ce5/32.png) [@h6585](https://www.dolibarr.org/forum/u/h6585)\
**Post date:** [March 7, 2019, 3:41pm UTC](https://www.dolibarr.org/forum/t/odt-2-pdf/17414/3 "2019-03-07T15:41:34Z")

</div>

Okay, will check.

Do you know what would be the font that is used in default pdf generation.

---

<div class="post-metadata">

**Author:** ![h6585](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/h/5f8ce5/32.png) [@h6585](https://www.dolibarr.org/forum/u/h6585)\
**Post date:** [March 8, 2019, 4:43am UTC](https://www.dolibarr.org/forum/t/odt-2-pdf/17414/4 "2019-03-08T04:43:15Z")

</div>

That link contains information that is Latin and Greek to me. Will have to sit and figure it out. Would you be able to write a step by step solution?

---

<div class="post-metadata">

**Author:** ![h6585](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/h/5f8ce5/32.png) [@h6585](https://www.dolibarr.org/forum/u/h6585)\
**Post date:** [March 8, 2019, 4:50am UTC](https://www.dolibarr.org/forum/t/odt-2-pdf/17414/5 "2019-03-08T04:50:22Z")

</div>

Also the error I get is different.

This is the error I get after activating the MAIN\_ODT\_AS\_PDF through Setup Other

Dolibarr has detected a technical error.  
This information can be useful for diagnostic purposes (you can set option $dolibarr\_main\_prod to ‘1’ to remove such notices):  
Date: 20190308100620  
Dolibarr: 9.0.0  
PHP: 7.0.33  
Server: Apache/2.4.38 (cPanel) OpenSSL/1.0.2q mod\_bwlimited/1.4 Phusion\_Passenger/5.3.7  
OS: Linux [md-ht-2.webhostbox.net](http://md-ht-2.webhostbox.net) 2.6.32-896.16.1.lve1.4.54.el6.x86\_64 #1 SMP Wed May 2 07:43:19 EDT 2018 x86\_64  
UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0

Requested URL: /erp/compta/facture/card.php?facid=16  
Referer: [https://www.attaritechnocrats.in/erp/compta/facture/card.php?facid=16&file=(PROV16)%2F(PROV16)\_CGST\_SGST\_Invoice\_format.odt&entity=1](https://www.attaritechnocrats.in/erp/compta/facture/card.php?facid=16&file=%28PROV16%29%2F%28PROV16%29_CGST_SGST_Invoice_format.odt&entity=1)  
Menu manager: eldy\_menu.php

Database type manager: mysqli  
Latest database access request error: No request in error  
Return code for latest database access request error: No request in error  
Information for latest database access request error: No request in error

Message: Error generating document for CommonObject. Error: ODT to PDF convert fail :

I have installed Dolibarr on my Linux based webserver.

---

<div class="post-metadata">

**Author:** ![h6585](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/h/5f8ce5/32.png) [@h6585](https://www.dolibarr.org/forum/u/h6585)\
**Post date:** [March 8, 2019, 4:55am UTC](https://www.dolibarr.org/forum/t/odt-2-pdf/17414/6 "2019-03-08T04:55:35Z")

</div>

What if I change the permission of my odf.php file located in /includes/odtphp/odf.php.

Currently it has 644 permission.

---

<div class="post-metadata">

**Author:** ![Knut](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/knut/32/310_2.png) [@Knut](https://www.dolibarr.org/forum/u/Knut)\
**Post date:** [March 8, 2019, 2:02pm UTC](https://www.dolibarr.org/forum/t/odt-2-pdf/17414/7 "2019-03-08T14:02:51Z")

</div>

have you defined the  
MAIN\_ODT\_AS\_PDF ► Activate PDF conversion from ODT document.then  
MAIN\_DOL\_SCRIPTS\_ROOT Must also be defined to path where the “scripts” directory is stored (for example /var/www/mydolibarr).

---

<div class="post-metadata">

**Author:** ![h6585](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/h/5f8ce5/32.png) [@h6585](https://www.dolibarr.org/forum/u/h6585)\
**Post date:** [March 8, 2019, 4:46pm UTC](https://www.dolibarr.org/forum/t/odt-2-pdf/17414/8 "2019-03-08T16:46:12Z")

</div>

This value should be defined in Scripts Other? I define the folder where my odf.php file is stored right?

---

<div class="post-metadata">

**Author:** ![Knut](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/knut/32/310_2.png) [@Knut](https://www.dolibarr.org/forum/u/Knut)\
**Post date:** [March 10, 2019, 8:20am UTC](https://www.dolibarr.org/forum/t/odt-2-pdf/17414/9 "2019-03-10T08:20:36Z")

</div>

Yes  
MAIN\_DOL\_SCRIPTS\_ROOT and value as example /var/www/mydolibarr

---

<div class="post-metadata">

**Author:** ![h6585](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/h/5f8ce5/32.png) [@h6585](https://www.dolibarr.org/forum/u/h6585)\
**Post date:** [March 12, 2019, 11:18am UTC](https://www.dolibarr.org/forum/t/odt-2-pdf/17414/10 "2019-03-12T11:18:23Z")

</div>

Still getting the same error. Do I have to upload any script file?

Like this one? [https://framagit.org/Battant/dolibarr/blob/839f73d5687966e80e6d337c3aab5ce48b051e3a/scripts/odt2pdf/odt2pdf.sh](https://framagit.org/Battant/dolibarr/blob/839f73d5687966e80e6d337c3aab5ce48b051e3a/scripts/odt2pdf/odt2pdf.sh)

---

<div class="post-metadata">

**Author:** ![h6585](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/h/5f8ce5/32.png) [@h6585](https://www.dolibarr.org/forum/u/h6585)\
**Post date:** [March 12, 2019, 12:05pm UTC](https://www.dolibarr.org/forum/t/odt-2-pdf/17414/11 "2019-03-12T12:05:45Z")

</div>

Uploaded the code on this link [scripts/odt2pdf/odt2pdf.sh · 839f73d5687966e80e6d337c3aab5ce48b051e3a · Michaël Parchet / dolibarr · GitLab](https://framagit.org/Battant/dolibarr/blob/839f73d5687966e80e6d337c3aab5ce48b051e3a/scripts/odt2pdf/odt2pdf.sh)

Still getting the following error

> [@](#):
>
> Dolibarr has detected a technical error.  
> This information can be useful for diagnostic purposes (you can set option $dolibarr\_main\_prod to ‘1’ to remove such notices):  
> Date: 20190312172847  
> Dolibarr: 9.0.0  
> PHP: 7.0.33  
> Server: Apache/2.4.38 (cPanel) OpenSSL/1.0.2q mod\_bwlimited/1.4 Phusion\_Passenger/5.3.7  
> OS: Linux [md-ht-2.webhostbox.net](http://md-ht-2.webhostbox.net) 2.6.32-896.16.1.lve1.4.54.el6.x86\_64 #1 SMP Wed May 2 07:43:19 EDT 2018 x86\_64  
> UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0
> 
> Requested URL: /erp/compta/facture/card.php?facid=16  
> Referer: [Login @ 16.0.0](https://www.attaritechnocrats.in/erp/compta/facture/card.php?facid=16&save_lastsearch_values=1)  
> Menu manager: eldy\_menu.php
> 
> Database type manager: mysqli  
> Latest database access request error: No request in error  
> Return code for latest database access request error: No request in error  
> Information for latest database access request error: No request in error
> 
> Message: Error generating document for CommonObject. Error: ODT to PDF convert fail :

---

<div class="post-metadata">

**Author:** ![h6585](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/h/5f8ce5/32.png) [@h6585](https://www.dolibarr.org/forum/u/h6585)\
**Post date:** [March 13, 2019, 9:38am UTC](https://www.dolibarr.org/forum/t/odt-2-pdf/17414/12 "2019-03-13T09:38:52Z")

</div>

Please help on this topic. I am stuck!!!

---

<div class="post-metadata">

**Author:** ![ProfixCFO](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/p/b9bd4f/32.png) [@ProfixCFO](https://www.dolibarr.org/forum/u/ProfixCFO)\
**Post date:** [December 27, 2020, 1:04am UTC](https://www.dolibarr.org/forum/t/odt-2-pdf/17414/13 "2020-12-27T01:04:03Z")

</div>

> [@Knut](#):
>
> “scr

Please what do you mean by the script directory? do you mean the directory where the OTD templates are stored?

---

<div class="post-metadata">

**Author:** ![ProfixCFO](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/p/b9bd4f/32.png) [@ProfixCFO](https://www.dolibarr.org/forum/u/ProfixCFO)\
**Post date:** [December 27, 2020, 1:53am UTC](https://www.dolibarr.org/forum/t/odt-2-pdf/17414/14 "2020-12-27T01:53:14Z")

</div>

Please can you help me with this? I have dolibarr 12.03. I really want to be able to convert ODT documents to PDF and I also need to be able to include additional variables. Like include line that has a fraction of the total sum displayed on invoices.

---

<div class="post-metadata">

**Author:** ![Knut](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/knut/32/310_2.png) [@Knut](https://www.dolibarr.org/forum/u/Knut)\
**Post date:** [December 27, 2020, 6:13am UTC](https://www.dolibarr.org/forum/t/odt-2-pdf/17414/15 "2020-12-27T06:13:49Z")

</div>

Hi, the filepath to your dolibarr main files in field where you add value:  
MAIN\_DOL\_SCRIPTS\_ROOT then the value to filepath like this /var/www/yourweb/public\_html/yourdolibarrmainfiles

---

<div class="post-metadata">

**Author:** ![umigun](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/umigun/32/7276_2.png) [@umigun](https://www.dolibarr.org/forum/u/umigun)\
**Post date:** [June 20, 2022, 5:41am UTC](https://www.dolibarr.org/forum/t/odt-2-pdf/17414/16 "2022-06-20T05:41:20Z")

</div>

hello, i have the same problem.  
The conversion completes when I test it on the server. but after creating ODT file in dolibarr it comes with .odt extension.  
I still haven’t been able to solve the problem.  
**thank you for your help**

> Doli version : 14.0.2  
> Server : Centos 7 - Cpanel/Whm  
> host: PHP version 7.4

I tried this solution published by ### **[h6585](https://github.com/h6585)**. (of course all other solutions didn’t work)

[https://github.com/Dolibarr/dolibarr/issues/10896](https://github.com/Dolibarr/dolibarr/issues/10896)  
**MAIN\_DOL\_SCRIPTS\_ROOT** = /home/xx/public\_html/erp/scripts/odt2pdf/  
**MAIN\_ODT\_AS\_PD** F = pyodconverter

 ![Screenshot_3](https://www.dolibarr.org/forum/uploads/dolibarrorg/original/2X/6/6d5f5302512376ec7583b0142694c114e017887d.jpeg)

file dir : /home/xx/public\_html/erp/scripts/odt2pdf

[odt2pdf.zip](https://www.dolibarr.org/forum/uploads/short-url/yD48oW4vBGOrToEOsDyGDlUSAPV.zip) (5.4 KB)

Host PHP-FPM setttings: exec,pasthru,shell\_exec, system = allow

**Server test:**  
[root@server1 odt2pdf]# ./odt2pdf.sh test pyodconverter  
[root@server1 odt2pdf]#  
result:  
[root@server1 odt2pdf]# ls  
DocumentConverter.py odt2pdf.sh #old\_odt2pdf.sh test.odt **test.pdf**  
[root@server1 odt2pdf]#  
**here the function does not work!**

 ![Screenshot_1](https://www.dolibarr.org/forum/uploads/dolibarrorg/original/2X/e/eb02f50e42f9c6a92cae93205c7e9ce6e2373e46.jpeg)

---

<div class="post-metadata">

**Author:** ![umigun](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/umigun/32/7276_2.png) [@umigun](https://www.dolibarr.org/forum/u/umigun)\
**Post date:** [June 23, 2022, 6:50am UTC](https://www.dolibarr.org/forum/t/odt-2-pdf/17414/17 "2022-06-23T06:50:15Z")

</div>

yes i finally found a solution thanks you [priojk](https://www.dolibarr.org/forum/u/priojk)

Apache (Ea4) / WHM-Cpanel \* install openoffice

> wget [Download Apache\_OpenOffice\_4.1.12\_Linux\_x86-64\_install-rpm\_en-US.tar.gz (Apache OpenOffice)](https://sourceforge.net/projects/openofficeorg.mirror/files/4.1.12/binaries/en-US/Apache_OpenOffice_4.1.12_Linux_x86-64_install-rpm_en-US.tar.gz)
> 
> tar xzf Apache\_OpenOffice\_4.1.12\_Linux\_x86-64\_install-rpm\_en-US.tar.gz
> 
> cd en-US/RPMS/
> 
> rpm -Uvh \*.rpm

> [@ODT to PDF conversion v14](https://www.dolibarr.org/forum/t/odt-to-pdf-conversion-v14/22425/4):
>
> Your solution is indeed the easiest one. However, I think what @umigun wants to achieve is using a easily configurable odt, but in the end have a pdf created from this, e.g. for sending it to customers. Not every recipient has Word/OpenOffice/LibreOffice installed an can read odt files. I just had a look and there is indeed some information in the French wiki: [Générer automatiquement des documents PDF à partir de fichier ODT avec Doliwamp - Dolibarr ERP CRM Wiki](https://wiki.dolibarr.org/index.php?title=G%C3%A9n%C3%A9rer_automatiquement_des_documents_PDF_%C3%A0_partir_de_fichier_ODT_avec_Doliwamp) So Chrome and right click to se…

 ![Screenshot_4](https://www.dolibarr.org/forum/uploads/dolibarrorg/original/2X/7/78abe2b131d7f01bd853fc1466439985e83d72d3.jpeg)

then the above steps

* * *

now makes your ODT templates PDF on server side. Our purpose is clearly for mobile users and those who cannot read ODT documents and therefore without installation provisioning such as openoffice, libreoffice.

ODT documents on the other hand can be edited. however, digitally signed PDF documents cannot be modified. Of course, those who use Dolibar with their mobile phone/tablet can create and send all documents in mobilization.

it was not easy to reach this result and I had to check the above steps, many topics in the forum and even resources such as dithub.

I hope it will be useful to everyone. I would like to thank everyone who supported the very talented development, delivery and support of Dolibarr.
