Create a PDF document template: Difference between revisions

→‎Activate your new model: Added troubleshooting and foreign characters
mNo edit summary
(→‎Activate your new model: Added troubleshooting and foreign characters)
Line 81: Line 81:
* activate your module
* activate your module
* eventually, set it as the default model.
* eventually, set it as the default model.
= Troubleshooting =
== Q: My PDF template doesn't understand foreign characters, it outputs them as ??? ==
This is probably a font problem, the current font used for generating the PDF cannot handle the foreign characters you are trying to print. So just try to use another set of font.
You will find the fonts used by Dolibarr to print PDF inside your Dolibarr folder.../includes/tcpdf/fonts/
To change the font used for generating PDF, you need to edit the 'main.lang' file of the language you are using (you'll find the file in your Dolibarr.../langs/en_US/main.lang for instance if you use English)
* Edit the main.lang file
* Locate the constant FONTFORPDF at the beginning of the file and change the value to FONTFORPDF=dejavusans for instance if you want to use dejavusans. Please note that sometimes FONTFORPDF may be missing, in this case you should add it at the beginning of the file.
* Save the file and try again to generate your PDF.
If you are unlucky, you can try with more fonts, just go to the TCPDF website sourceforge.net/projects/tcpdf/files/ and download the latest zip package. Then extract only the 'fonts' folder from the zip. Then copy the files in your Dolibarr installation .../includes/tcpdf/fonts/ so you will get more fonts to play with.
Also, please make a backup of your files before to modify.
Thank's to Humphrey for the tip.
439

edits