PDF 报表中文支持模块:base_report_cn
-
感谢你的消息回复!
这个模块包我回去导入了试了下,直接导入的时候OpenERP会报错
[attach]181[/attach]后来我试了一下解压缩这个包(会提示复盖,不知道为什么)
重新打成.zip包后,到OpenERP里导入这个模块,可以成功导入,但打印的时候又提示出错,说找不到TTF这个字体
[attach]182[/attach]然后我就把那个包解压出来,将base_report_cn目录直接复制到serveraddons目录下,再试着打印终于看到熟悉亲切的中文了:) 心情那个激动啊,这个问题拆腾我2天了,网上找了N遍,也试了N种方式,今天终于解决了,非常感谢你的帮忙!!!!!!
[attach]183[/attach] -
中文pdf输出从此很容易了。非常感谢oldrev的贡献。
-
Traceback (most recent call last):
File "/usr/local/lib/python2.5/site-packages/openerp-server/service/web_services.py", line 600, in go
(result, format) = obj.create(cr, uid, ids, datas, context)
File "/usr/local/lib/python2.5/site-packages/openerp-server/report/report_sxw.py", line 645, in create
return self.create_single(cr, uid, ids, data, report_xml, context)
File "/usr/local/lib/python2.5/site-packages/openerp-server/report/report_sxw.py", line 733, in create_single
pdf = create_doc(rml2, logo, title.encode('utf8'))
File "/usr/local/lib/python2.5/site-packages/openerp-server/report/interface.py", line 199, in create_pdf
obj.render()
File "/usr/local/lib/python2.5/site-packages/openerp-server/report/render/render.py", line 50, in render
result = self._render()
File "/usr/local/lib/python2.5/site-packages/openerp-server/report/render/rml.py", line 36, in _render
return rml2pdf.parseString(self.xml, images=self.bin_datas, path=self.path,title=self.title)
File "/usr/local/lib/python2.5/site-packages/openerp-server/addons/base_report_cn/init.py", line 79, in convert2TrueType
data = data.replace(old, new)
File "/usr/local/lib/python2.5/site-packages/openerp-server/report/render/rml2pdf/trml2pdf.py", line 803, in parseString
r.render(fp)
File "/usr/local/lib/python2.5/site-packages/openerp-server/report/render/rml2pdf/trml2pdf.py", line 214, in render
self.docinit(el)
File "/usr/local/lib/python2.5/site-packages/openerp-server/report/render/rml2pdf/trml2pdf.py", line 191, in docinit
pdfmetrics.registerFont(TTFont(name, fname ))
File "/usr/local/lib/python2.5/site-packages/reportlab/pdfbase/ttfonts.py", line 960, in init
canvas.drawString(x, y, "Some text encoded in UTF-8")
File "/usr/local/lib/python2.5/site-packages/reportlab/pdfbase/ttfonts.py", line 875, in init
return output.makeStream()
File "/usr/local/lib/python2.5/site-packages/reportlab/pdfbase/ttfonts.py", line 398, in init
return stm.getvalue()
File "/usr/local/lib/python2.5/site-packages/reportlab/pdfbase/ttfonts.py", line 463, in extractInfo
self.seek(string_data_offset + offset)
TTFError: Could not find PostScript font name -
[quote]Could not find PostScript font name[/quote]
报表中使用了系统中不存在的字体?