Line 15:
Line 15:
An ODT template does not require PHP knowledge. To build an ODT template, see this page [[Create an ODT document template]].
An ODT template does not require PHP knowledge. To build an ODT template, see this page [[Create an ODT document template]].
−
=Prerequisite=
+
=Prerequisites=
*Dolibarr: 3.0+
*Dolibarr: 3.0+
Line 29:
Line 29:
propale for commercial proposals
propale for commercial proposals
facture for invoices
facture for invoices
−
commandes for orders, etc...
+
commande for orders, etc...
and finally '''doc''' or '''pdf'''.
and finally '''doc''' or '''pdf'''.
For instance, proposal templates will be located in '''...core/modules/propale/doc/'''
For instance, proposal templates will be located in '''...core/modules/propale/doc/'''
Line 35:
Line 35:
=Create a new template=
=Create a new template=
==For an existing module==
==For an existing module==
−
Do not modify an existing template. Copy the file of the template used as example into a new name in same directory than your example and edit it to change content.
+
Do not directly modify an existing template. Copy the file of the template used as example into a new name in same directory and edit it to change content.
For this example, we will call our new template 'mycompanyblue', based on the existing template 'azur':
For this example, we will call our new template 'mycompanyblue', based on the existing template 'azur':
Line 69:
Line 69:
==Library for PDF manipulation==
==Library for PDF manipulation==
−
The library used to create PDF documents in PHP is called FPDF and can be found in htdocs/includes/tcpdf/tcpdf.class.php (or htdocs/includes/tecnickcom/tcpdf/tcpdf.class.php). This class contains the methods used to generate different parts of documents.
+
The library used to create PDF documents in PHP is called TCPDF and can be found in htdocs/includes/tcpdf/tcpdf.class.php (or htdocs/includes/tecnickcom/tcpdf/tcpdf.class.php). This class contains the methods used to generate different parts of documents.
Templates instantiate the FPDF class and use its methods combined with the specific data of the invoice, order etc.
Templates instantiate the FPDF class and use its methods combined with the specific data of the invoice, order etc.