创建PDF模板: Difference between revisions

Jump to navigation Jump to search
No edit summary
Tag: 2017 source edit
 
Line 147: Line 147:
*http://www.fpdf.org/?lang=en
*http://www.fpdf.org/?lang=en
*TCPDF函数清单:<nowiki>https://tcpdf.org/docs/srcdoc/</nowiki>
*TCPDF函数清单:<nowiki>https://tcpdf.org/docs/srcdoc/</nowiki>
*


=激活您的新模板=
=通过模块提供您的模板=
前往 '''主页 => 设置 => 模块/应用 =>'''
如果制作的模板打算通过Dolibarr扩展模块交付(请参阅文档以创建Dolibarr模块),则您的模板文件将不与其他模板文件位于同一目录中,因此不会被自动检测到。要使其可被检测到,您需要在扩展模块的初始化函数中添加以下行:
 
*激活您的模块
*最终,将其设置为默认模板
 
=Proposer son modèle via un module=
Si le modèle fabriqué est destiné à être livré via un module extension de Dolibarr (voir la doc pour faire un module Dolibarr), le fichier modèle ne sera pas dans le même répertoire que les autres, et ne sera donc pas détecté automatiquement. Pour  le rendre détectable vous devrez ajouter cette ligne dans la fonction d'initialisation de votre module externe :


<syntaxhighlight lang="PHP">
<syntaxhighlight lang="PHP">
Line 162: Line 155:
</syntaxhighlight>
</syntaxhighlight>


avant
前面


<syntaxhighlight lang="PHP"> return $this->_init($sql,$option);</syntaxhighlight>
<syntaxhighlight lang="PHP"> return $this->_init($sql,$option);</syntaxhighlight>


Puis
之后,前往 '''主页 => 设置 => 模块/应用 => 模板所在的模块=>配置'''


Dans Accueil => Configuration => Modules => Module sur lequel porte le modèle => Configurer
*激活应该出现在可用模块中的您的模块
*可以将其设置为默认建议的模板


*activer votre module qui doit apparaître parmi ceux disponible
=关于该主题的视频=
*éventuellement le mettre en modèle proposé par défaut.
<youtube width="200" height="120">dEC8hFcT71U</youtube>


=Vidéos sur le sujet=
<youtube width="200" height="120">dEC8hFcT71U</youtube>
<youtube width="200" height="120">LtXPBz9fWQE</youtube>
<youtube width="200" height="120">LtXPBz9fWQE</youtube>


=故障排除=
=故障排除=


==Q: My PDF template doesn't understand foreign characters, it outputs them as ???==
==问题:我的PDF模板无法识别外语字符,它会将它们输出为 ???==


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.
这可能是字体的问题,当前用于生成PDF的字体无法处理您试图打印的外语字符。所以,请尝试使用另一种字体。


You will find the fonts used by Dolibarr to print PDF inside your Dolibarr folder.../includes/tcpdf/fonts/
您将在您的Dolibarr文件夹中找到Dolibarr用于打印PDF的字体:.../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)
要更改用于生成PDF的字体,您需要编辑您正在使用的语言的“main.lang”文件(例如,如果您使用英语,您可以在您的 Dolibarr.../langs/en_US/main.lang 中找到该文件)


*Edit the main.lang file
*编辑文件 main.lang
*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.
*找到文件开头的常量FONTFORPDF,并将值更改为FONTFORPDF=dejavusans,例如,如果您想使用dejavusan。请注意,有时FONTFORPDF可能会丢失,在这种情况下,您应该将其添加到文件的开头。
*Save the file and try again to generate your PDF.
*保存文件,然后再次尝试生成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.
如果你运气不好,你可以尝试使用更多的字体,只需访问TCPDF网站 sourceforge.net/projects/TCPDF/files/ 并下载最新的zip包。然后只从zip中提取“fonts”文件夹。最后复制到Dolibarr安装中的 .../includes/tcpdf/fonts/,这样您将获得更多可供使用的字体。


Also, please make a backup of your files before to modify.
此外,请在修改之前备份您的文件。


Alternative if this doesn't work: make sure the Translation class is correctly instanciated and loaded with the correct language inside your PDF templates (stored inside the $langs or $outputlangs variable).
如果这不起作用,请选择:确保Translation类已正确安装,并在PDF模板中加载了正确的语言(存储在$langs或$outputlangs变量中)。


Thank's to Humphrey for the tip.
感谢 Humphrey 的提示。
714

edits

Navigation menu