Odt to Pdf conversion error (invoice)

Hello everyone, I am working on implementing Dolibarr as ERP/CRM in our company and it is fun working with it so far.

I am currently having some issues with the automatic transformation of an invoice(odt) to a pdf.
Currently using Doliwamp 17.01 and having all my extrafields and odt templates setup and running the way we need it.

I setup Libreoffice and inserted the “soffice.exe” path in system paths, I set the “MAIN_ODT_AS_PDF is LibreOffice”.

So basically everything is setup the way it is needed but when I try to generate a pdf I get this issue:

Blockquote:
Datei ‘IN2303-0009.Mahnung.odt’ konnte nicht in PDF konvertiert werden: ODT to PDF convert fail (option MAIN_ODT_AS_PDF is libreoffice, command was soffice --headless ‘//c:/dolibarr/dolibarr_documents/users/temp’ --convert-to pdf --outdir ‘c:/dolibarr/dolibarr_documents/facture/IN2303-0009’ ‘c:/dolibarr/dolibarr_documents/facture/IN2303-0009/IN2303-0009.Mahnung.odt’, retval=1) :

Which says " File IN2303-0009.Mahnung.odt could not be converted to PDF.

I am this close to implenmenting Dolibarr in the company but if this issue isnt solved I sadly can not use it.

Anyone might help me here :)?

Hi @Edelstahlbarr,

currently I see the following points to check:

  1. according to Setup Other - Dolibarr ERP CRM Wiki the value of MAIN_ODT_AS_PDF is “libreoffice” in lower cases. Not sure if this is case sensitive, but give it a try.
  2. can you run the command “soffice” in windows command line (without being in the folder of libre office)?
  3. Can you try the mentioned command in your error directly in the windows command line without dolibarr? does it work? what is the output?

Best regards,
Sven

1 Like

Thanks for the reply,

  1. I checked it and its the same as in the tutorial from the wiki
  2. When I run the command “start soffice”, it says “soffice” could not be found so that might be the issue?

Which is strange as I put the “soffice path” into the system variables.

Hi,

can you try it with only “soffice” in the command line and not with the PowerShell. Does this makes a difference? I think in both cases the path needs to be set correctly, without it, LibreOffice cannot be found.

Regards,
Sven

1 Like

Typing only “soffice” into the cmd.line it just says that the command could not be found.
Any ideas on how to set the path correctly?

Currently it is this :
C:\Program Files\LibreOffice\program

When I run the soffice.exe manually inside of this folder it works…

EDIT:
I got it working,just added it to sysvar again and rebooted the computer.
Now there is only one error remaining when trying to convert the odt which is this one:

Blockquote
Datei ‘IN2304-0010.dritte.Mahnung.odt’ konnte nicht in PDF konvertiert werden: ODT to PDF convert fail (option MAIN_ODT_AS_PDF is soffice, command was …/…/scripts/odt2pdf/odt2pdf.sh c:/dolibarr/dolibarr_documents/facture/IN2304-0010/IN2304-0010.dritte.Mahnung soffice, retval=1) :

Nobody got any idea on this?

Hello,

Try to launch the command on a promt :

1 Like

Many thanks for your reply ksar! :slight_smile:
When I try to run it as a prompt via the cmd,it says that “command” could not be found.
I just copied this part :

Blockquote
command was …/…/scripts/odt2pdf/odt2pdf.sh c:/dolibarr/dolibarr_documents/facture/IN2304-0010/IN2304-0010.dritte.Mahnung soffice, retval=1

and pasted it into cmd to run it,or am I doing something wrong?

EDIT:
I was able to solve this issue with some tweaking around in the odf.php file.

If anyone is interested in the solution,just write me :slight_smile:

This can be closed.

Hi @Edelstahlbarr,

I am interested in the solution of this issue. Can you share it with the community also?

Regards,
Sven

1 Like

Sure, here is a detailed description with all the files already changed for odt2pdf settings.

I am currently having an issue with product extrafields not saving the choosen dropdown values when creating or changing a product, maybe you have any ideas on this ? :slight_smile:

ODT2PDF Solution.zip (93.9 KB)