SugarCRM:PDF 生成
我是 SugarCRM 开发的新手。在我的项目中,我必须为一个实体详细信息(例如帐户详细信息)生成一份 pdf。在详细信息页面上,我添加了“打印 PDF”按钮,单击此按钮后我有一个独立的脚本(我的意思是说它没有按照 Sugar 框架实现)。在此脚本中,我们查询数据库以获取所需的详细信息并构建一个 html 字符串。使用 html2pdf 库,将此 html 字符串转换为 pdf。
我不知道这是否是一个有效的实施,但一切都按照要求正常工作。但是当原始字符串包含一些特殊字符(例如不同国家的货币符号)时,我们会遇到一个问题。我们得到的 html 很好,但在 pdf 中,这些特殊字符却出现了问号 (?)。
在尝试解决此问题时,当我查看 SugarCRM 代码时,我发现一些 pdf 类位于 include/ 目录中,这给人一种 Sugar 本身有一些内置库来生成 pdf 的印象。这是真的吗? 如果这是真的,它会解决我的问题吗,即在pdf中显示不同国家的货币符号。
有人可以帮我解决这个问题吗?提前致谢。
-文卡特·尼哈塔
I'm a newbie to SugarCRM development. In my project, I have to generate a pdf for one entity details(say Account details). On details page, I have added "Print PDF" button, upon clicking this button I have one independent script (I mean to say that it was not implemented as per Sugar framework). In this script we are querying database for the required details and building one html string. Using html2pdf library, converting this html string to pdf.
I dont know whether it is an efficient implementation or not, but everything is working fine as per the requirement. But we have one problem when the original string contains some special characters like currency symbols of different countries. We are getting the html fine, but in pdf getting question marks (?) for those special characters.
While trying to fix this issue, when I looked into SugarCRM code, I found some pdf classed inside includes/ directory that creating an impression that Sugar itself has some built-in library to generate pdf's. Is it true?
If that is true, will it solve my problem, i.e. displaying different countries currency symbols in pdf.
Can anybody please help me to in resolving this. Thanks in advance.
-Venkat Nehatha
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Venkat,SugarCRM确实有自己的pdf生成能力。我们用它来生成客户订单、报价、发票和报表。
虽然我自己在 pdf 生成方面做了一些工作,但我认为我的经验还不足以详细指导其他人使用 Sugar 的 pdf 功能。我可以告诉你,我们仅在我们自己的自定义模块中使用 pdf 生成,因此文件位于 [sugarRoot]/modules/[customModule]/ 中。 (您可能知道,除非您确切地知道自己在做什么,否则切勿修改 [root]/modules/ 文件夹中的主要 SugarCRM 文件!)在前面提到的自定义模块文件夹中有两个子文件夹“sugarpdf”,其中具有访问模块/数据库以获取要写入 pdf 的信息的代码,以及一个“tpls”文件夹,该文件夹以 HTML 格式保存 pdf 的页眉、正文和页脚的布局信息,使用来自糖.pdf文件夹的文件。
我强烈建议您访问 SugarCRM 开发者论坛,您可以在其中与我们联系在 Sugar 领域,许多开发人员比我更有经验。
我希望这能在某种程度上有所帮助。
Venkat, SugarCRM does indeed have its own pdf generation ability. We use it to generate customer orders, quotes, invoices, and statements.
Though I've done some work on the pdf generation myself, I don't think I'm really experienced enough to be able to guide someone else in detail in the use of Sugar's pdf capabilities. I can tell you that we use pdf generation only in our own custom modules, so the files are found in [sugarRoot]/modules/[customModule]/. (You may know that unless you know exactly what you're doing, NEVER modify the main SugarCRM files in the [root]/modules/ folder!) In the previously mentioned custom module folder are two sub-folders, "sugarpdf", which has the code that accesses the modules/database to get the information to write to the pdf, and a "tpls" folder that holds the layout information for the header, body, and footer of the pdf, in HTML format, using the information from the sugarpdf folder's file.
I strongly recommend you visit the SugarCRM developer forums where you will be in touch with many developers much more experienced than me in Sugar.
I hope this helps in some way.