Identification



Welcome, Guest
Please Login or Register.    Lost Password?

PDF Custom Invoice
(1 viewing) (1) Guest
Go to bottomPage: 12
TOPIC: PDF Custom Invoice
#21401
PDF Custom Invoice 6 Months, 3 Weeks ago Karma: 1
Hello,

My small contribution of creation on the custom invoices.

I Use the Dolibarr ODT Template resource (wiki.dolibarr.org/index.php/Create_an_ODT_document_template) with jodconverter (odt to pdf converter).


Steps:

1. Create your ODT Template in OpenOffice or LibreOffice. eg: www.comdesk.com.br/downloads/template_invoice.odt

2. Replace the original ODT Template. The path is: \documents\doctemplates\invoices.

3. Edit the file: doc_generic_invoice_odt.modules. The path is: \htdocs\core\modules\facture\doc\

4. Around line 315, add the code:
Code:

//Variable for convert odt to pdf - Marcelo Costa
$filePDF='jodconverter -f pdf '.$file;




5. Around line 502, add the code:
Code:

//Execute jodconverter - Marcelo Costa
exec($filePDF);
//Delete odt reference - Marcelo Costa
unlink($file);



6. In your LAMP server, install the jodconverter. apt-get install jodconverter.

7. Create a script to start openoffice service on the linux.

- Create the new file:
nano /etc/init.d/soffice.sh

- Input the content in this file:
#!/bin/bash
unset DISPLAY
soffice -headless -accept="socket,host=localhost,port=8100;urp;" -nofirststartwizard


- Give permission to execute:
chmod +x /etc/init.d/soffice.sh

- Start with a your system:
update-rc.d soffice.sh defaults

8. Restart the server.

9. In Dolibarr, enable the ODT templates, in Invoice Modules.

10. When generate a invoice, choose the model template_invoice.odt.


The routine with tested in Ubuntu Server 10.04...Another server, see jodconverter documentation.

Regards,
Marcelo
marceloeng
Junior Boarder
Posts: 21
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#21404
Re: PDF Custom Invoice 6 Months, 3 Weeks ago Karma: 0
For which version is this?
IT-KAM
Junior Boarder
Posts: 21
graphgraph
User Offline Click here to see the profile of this user
Gender: Male m-h_edwin.kamstra Location: Lelystad, The Netherlands Birthday: 06/05
The administrator has disabled public write access.
 
#21405
Re: PDF Custom Invoice 6 Months, 3 Weeks ago Karma: 6
@marceloeng: Thank's for the tutorial, nice feedback.

IT-KAM wrote:
For which version is this?

This should work for any Dolibarr version that supports the ODT templating system, so Dolibarr >= 3.2
lrq3000
Senior Boarder
Posts: 70
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#21407
Re:PDF Custom Invoice 6 Months, 3 Weeks ago Karma: 1
Hi,

I believe that work in 3.2 version or high.

I have tested with 3.3.0 Alpha. Last trunk downloaded in github on 25 ocotber.

Regards,
Marcelo
marceloeng
Junior Boarder
Posts: 21
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#21410
Re: PDF Custom Invoice 6 Months, 3 Weeks ago Karma: 0
Thanks for the quick response! I am right now on 3.2.2 so I will give it a try on my test machine.
IT-KAM
Junior Boarder
Posts: 21
graphgraph
User Offline Click here to see the profile of this user
Gender: Male m-h_edwin.kamstra Location: Lelystad, The Netherlands Birthday: 06/05
The administrator has disabled public write access.
 
#21465
Re:PDF Custom Invoice 6 Months, 3 Weeks ago Karma: 1
Hi marcelo, thanks for you usefull suggestion!
A question: i use dolibarr on windows, i need to install jodconverter and the Openoffice's script also on windows?
Can you help me make it working also on windows?
Thanks in advance
godevolution
Fresh Boarder
Posts: 4
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#21469
Re:PDF Custom Invoice 6 Months, 3 Weeks ago Karma: 1
Hi godevolution,

I have not testet, but I believe that you shoul install jodconverter (sourceforge.net/projects/jodconverter/files/JODConverter/2.2.2/) and create openffice service (www.artofsolving.com/node/11).

--
Marcelo
marceloeng
Junior Boarder
Posts: 21
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#21523
Re:PDF Custom Invoice 6 Months, 2 Weeks ago Karma: 0
Thanks Marcelo,

Great solution, I have this working on 3.2.2. Couple of notes.

1. I ran as follows to install openoffice on 10.04

apt-get install openoffice.org-headless openoffice.org-writer openoffice.org-draw

then installed jod converter.

2. The code at line 502 needs to be before line
"return 1; // Success"
toomanylogins
Expert Boarder
Posts: 87
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#21546
Re:PDF Custom Invoice 6 Months, 2 Weeks ago Karma: 0
This is great Marcelo !

Thank you for sharing.

In my case, i have installed dolibarr in my hosting, so i don have access to linux for do that.

Do you think is it possible that Dolibarr creates a PDF from my modified ODT only using PHP?, if yes, it will make me very happy
planpc
Junior Boarder
Posts: 37
graphgraph
User Offline Click here to see the profile of this user
planpc@gmail.com Location: Madrid Birthday: 07/08
The administrator has disabled public write access.
 
#21550
Re:PDF Custom Invoice 6 Months, 2 Weeks ago Karma: 1
toomanylogins,

When install JOD Converter (apt-get install jodconverter), your dependecies are installed also.

Yes...the code need before "return 1; // Success".

Planpc,
Is possible, but very hard.
see the link: wiki.dolibarr.org/index.php/Create_a_PDF_document_template
marceloeng
Junior Boarder
Posts: 21
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
Go to topPage: 12