It is currently Sat Feb 11, 2012 10:30 am

All times are UTC + 2 hours




Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: report in chinese 2 -> use reportlab 2.0 and TTF fonts
PostPosted: Sat Aug 26, 2006 6:18 am 
Offline

Joined: Sat Jan 21, 2006 5:32 am
Posts: 21
Location: SHENZHEN, China
reportlab 2.0 have greate improve for unicode and chinese support, so update to reportlab 2.0, and change rml2pdf\__init__.py to:
Code:
from reportlab.lib.fonts import addMapping
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
from reportlab.pdfbase.cidfonts import UnicodeCIDFont, findCMapFile
from reportlab.lib.fonts import addMapping


pdfmetrics.registerFont(UnicodeCIDFont('STSong-Light'))
pdfmetrics.registerFont(TTFont('SimSun','simsun.ttc'))
pdfmetrics.registerFont(TTFont('SimHei','simhei.ttf'))
pdfmetrics.registerFont(TTFont('SimKai','simkai.ttf'))
pdfmetrics.registerFont(TTFont('SimFang','simfang.ttf'))
pdfmetrics.registerFont(TTFont('SimLi','simli.ttf'))
pdfmetrics.registerFont(TTFont('SimYou','simyou.ttf'))

for facename in ['SimSun','SimHei','SimKai','SimFang','SimLi','SimYou']:
   addMapping(facename, 0, 0, facename)    #normal
   addMapping(facename, 0, 1, facename)    #italic
   addMapping(facename, 1, 0, facename)    #bold
   addMapping(facename, 1, 1, facename)    #italic and bold
   


Now use 'UTF-8' encoding, find encoding='cp1252' in trml2pdf.py and change to encoding = 'UTF-8', and maybe you want chang getSampleStyleSheet, add follow code:
Code:
from reportlab.lib.enums import TA_LEFT, TA_RIGHT, TA_CENTER, TA_JUSTIFY
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle, StyleSheet1

def getZhSampleStyleSheet():
    """Returns a chinese stylesheet object"""
    stylesheet = StyleSheet1()

    stylesheet.add(ParagraphStyle(name='Normal',
                                  fontName='SimSun',
                                  fontSize=10,
                                  leading=12)
                   )

    stylesheet.add(ParagraphStyle(name='BodyText',
                                  parent=stylesheet['Normal'],
                                  spaceBefore=6)
                   )
    stylesheet.add(ParagraphStyle(name='Italic',
                                  parent=stylesheet['BodyText'],
                                  fontName = 'SimSun')
                   )

    stylesheet.add(ParagraphStyle(name='Heading1',
                                  parent=stylesheet['Normal'],
                                  fontName = 'SimSun',
                                  fontSize=18,
                                  leading=22,
                                  spaceAfter=6),
                   alias='h1')

    stylesheet.add(ParagraphStyle(name='Title',
                                  parent=stylesheet['Normal'],
                                  fontName = 'SimSun',
                                  fontSize=18,
                                  leading=22,
                                  alignment=TA_CENTER,
                                  spaceAfter=6),
                   alias='title')

    stylesheet.add(ParagraphStyle(name='Heading2',
                                  parent=stylesheet['Normal'],
                                  fontName = 'SimSun',
                                  fontSize=14,
                                  leading=18,
                                  spaceBefore=12,
                                  spaceAfter=6),
                   alias='h2')

    stylesheet.add(ParagraphStyle(name='Heading3',
                                  parent=stylesheet['Normal'],
                                  fontName = 'SimSun',
                                  fontSize=12,
                                  leading=14,
                                  spaceBefore=12,
                                  spaceAfter=6),
                   alias='h3')

    stylesheet.add(ParagraphStyle(name='Bullet',
                                  parent=stylesheet['Normal'],
                                  firstLineIndent=0,
                                  spaceBefore=3),
                   alias='bu')

    stylesheet.add(ParagraphStyle(name='Definition',
                                  parent=stylesheet['Normal'],
                                  firstLineIndent=0,
                                  leftIndent=36,
                                  bulletIndent=0,
                                  spaceBefore=6,
                                  bulletFontName='SimSun'),
                   alias='df')

    stylesheet.add(ParagraphStyle(name='Code',
                                  parent=stylesheet['Normal'],
                                  fontName='SimSun',
                                  fontSize=8,
                                  leading=8.8,
                                  firstLineIndent=0,
                                  leftIndent=36))


    return stylesheet


search reportlab.lib.styles.getSampleStyleSheet() and replace to getZhSampleStyleSheet()
getZhSampleStyleSheet() just for a example, you can write your stylesheet by youself.


Top
 Profile  
 
 Post subject: Chinese character still not display.
PostPosted: Thu Aug 31, 2006 1:15 pm 
Offline

Joined: Thu May 11, 2006 4:21 am
Posts: 6
Location: Kuala Lumpur, Malaysia
My OS is FC5, I use "yum install tinyerp tinyerp-server" to install the TinyERP,
then I download the reportlab 2.0 and "tar zxvf reportlab" and copy the reportlab directory to /usr/lib/python2.4/site-package/reportlab,
and I only have SimSun and SimHui, so I copy into ../reportlab/fonts,
then I follow your setting, it show me can not find getSampleStyleSheet, if I comment the whole line, the server can run, but the CHINESE CHARACTER STILL NOT PRINT ????
Is it any step by step setup guide ??
Actually I just want to print my partner name and product name in English together with the Chinese name.
Thank you.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 27, 2006 5:59 am 
Offline

Joined: Sat Jan 21, 2006 5:32 am
Posts: 21
Location: SHENZHEN, China
I only try in winxp and win2000, not have linux.
Maybe you should try python2.4 and install from source code.
If I have time, I will try Linux.

_________________
_
Gmail&Gtalk: vcc.163 at gmail.com


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 13, 2007 4:17 pm 
Offline

Joined: Tue Oct 24, 2006 10:43 am
Posts: 591
I'm stuck! I tried it the way described in the Wiki and the way vcc explained above. Both don't work. I think I'm missing something but don't know what. Can somebody (vcc?) explain it in more detail please? Esspecially the part about which files have to be changed and which files have to be copied where?

Thanks in advance,

knerz

I'm using v4.0.2 on ubuntu linux 6.06


Top
 Profile  
 
 Post subject: report in ubuntu 6.10
PostPosted: Wed Feb 21, 2007 5:43 am 
Offline

Joined: Sat Jan 21, 2006 5:32 am
Posts: 21
Location: SHENZHEN, China
Happy chinese new year!
In chinese new year holiday, I have test in the ubuntu 6.10, follow this step:

1. make sure python encoding is utf-8, do like this:
sudo vi /usr/lib/python2.4/sitecustomize.py
add follow:
Code:
import sys

sys.setdefaultencoding('UTF-8')

in windows, put sitecustomize.py in tinyerp bin path also work, but in ubuntu not work, need put in system path.

2. check the reportlab version, must 2.0, in ubuntu 6.10, apt-get install is reportlab2.0, so it's ok. (sudo apt-get install python-reportlab)

3. check the chinese fonts, ls /usr/share/fonts/turetype, for me, I just copy the windows fonts simsun.ttc ... to /usr/share/fonts/turetype.
open tinyerp-server/bin/report/render/rml2pdf/__init__.py, add follow:
Code:
from reportlab.lib.fonts import addMapping
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
from reportlab.pdfbase.cidfonts import UnicodeCIDFont, findCMapFile
from reportlab.lib.fonts import addMapping


pdfmetrics.registerFont(UnicodeCIDFont('STSong-Light'))
pdfmetrics.registerFont(TTFont('SimSun','simsun.ttc'))
pdfmetrics.registerFont(TTFont('SimHei','simhei.ttf'))
pdfmetrics.registerFont(TTFont('SimKai','simkai.ttf'))
pdfmetrics.registerFont(TTFont('SimFang','simfang.ttf'))
pdfmetrics.registerFont(TTFont('SimLi','simli.ttf'))
pdfmetrics.registerFont(TTFont('SimYou','simyou.ttf'))

for facename in ['SimSun','SimHei','SimKai','SimFang','SimLi','SimYou']:
   addMapping(facename, 0, 0, facename)    #normal
   addMapping(facename, 0, 1, facename)    #italic
   addMapping(facename, 1, 0, facename)    #bold
   addMapping(facename, 1, 1, facename)    #italic and bold

please change it to your fonts.

4. open tinyerp-server/bin/report/render/rml2pdf/, search encoding and change to encoding = 'UTF-8', then add follow after import os:
Code:
from reportlab.lib.enums import TA_LEFT, TA_RIGHT, TA_CENTER, TA_JUSTIFY

from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle, StyleSheet1



def getZhSampleStyleSheet():

    """Returns a chinese stylesheet object"""

    stylesheet = StyleSheet1()



    stylesheet.add(ParagraphStyle(name='Normal',

                                  fontName='SimSun',

                                  fontSize=10,

                                  leading=12)

                   )



    stylesheet.add(ParagraphStyle(name='BodyText',

                                  parent=stylesheet['Normal'],

                                  spaceBefore=6)

                   )

    stylesheet.add(ParagraphStyle(name='Italic',

                                  parent=stylesheet['BodyText'],

                                  fontName = 'SimSun')

                   )



    stylesheet.add(ParagraphStyle(name='Heading1',

                                  parent=stylesheet['Normal'],

                                  fontName = 'SimSun',

                                  fontSize=18,

                                  leading=22,

                                  spaceAfter=6),

                   alias='h1')



    stylesheet.add(ParagraphStyle(name='Title',

                                  parent=stylesheet['Normal'],

                                  fontName = 'SimSun',

                                  fontSize=18,

                                  leading=22,

                                  alignment=TA_CENTER,

                                  spaceAfter=6),

                   alias='title')



    stylesheet.add(ParagraphStyle(name='Heading2',

                                  parent=stylesheet['Normal'],

                                  fontName = 'SimSun',

                                  fontSize=14,

                                  leading=18,

                                  spaceBefore=12,

                                  spaceAfter=6),

                   alias='h2')



    stylesheet.add(ParagraphStyle(name='Heading3',

                                  parent=stylesheet['Normal'],

                                  fontName = 'SimSun',

                                  fontSize=12,

                                  leading=14,

                                  spaceBefore=12,

                                  spaceAfter=6),

                   alias='h3')



    stylesheet.add(ParagraphStyle(name='Bullet',

                                  parent=stylesheet['Normal'],

                                  firstLineIndent=0,

                                  spaceBefore=3),

                   alias='bu')



    stylesheet.add(ParagraphStyle(name='Definition',

                                  parent=stylesheet['Normal'],

                                  firstLineIndent=0,

                                  leftIndent=36,

                                  bulletIndent=0,

                                  spaceBefore=6,

                                  bulletFontName='SimSun'),

                   alias='df')



    stylesheet.add(ParagraphStyle(name='Code',

                                  parent=stylesheet['Normal'],

                                  fontName='SimSun',

                                  fontSize=8,

                                  leading=8.8,

                                  firstLineIndent=0,

                                  leftIndent=36))





    return stylesheet

search reportlab.lib.styles.getSampleStyleSheet() and replace to getZhSampleStyleSheet()
getZhSampleStyleSheet() just for a example, you can write your stylesheet by youself.

5. now you can test print screen, for me it's work.
6. you can change the font name in .xsl to your chinese font name, Simsun,...., make sure your editor encoding is utf-8.
Image
Image
Image[/code]

_________________
_
Gmail&Gtalk: vcc.163 at gmail.com


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 28, 2007 9:51 am 
Offline

Joined: Tue Oct 24, 2006 10:43 am
Posts: 591
thanks!

Quote:
3. check the chinese fonts, ls /usr/share/fonts/turetype, for me....


the location where reportlab is looking for the TTF-files can be found here:

/tinyerp-server/bin/reportlab/rl_config.py

or the required fonts can be copied to
tinyerp-server/bin/reportlab/fonts/

Note: for version>4.x.x the above mentioned folder doesn't exist anymore. You can look up searched folder in /usr/lib/python2.5/site-packages/reportlab/rl_config.py

I copied my ttf-files to:

/usr/share/fonts/truetype


Last edited by knerz on Fri Oct 05, 2007 11:28 am, edited 2 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 02, 2007 9:48 am 
Offline

Joined: Tue Oct 24, 2006 10:43 am
Posts: 591
worked for me, too. I only had to change "UnicodeCIDFont" to "CIDFont".

But when using a Mac Server the simsun.ttc isn't working ("... is not a truetype font!") but simhei.ttf is working. thanks!


EDIT: it's only working for a "Print screen" action. If I choose "print lables" (in the partner form view) thes characters are all messed up like this:


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 05, 2007 7:03 am 
Offline

Joined: Tue Oct 24, 2006 10:43 am
Posts: 591
Hi again!

Obviously your chinese translation is better than the one I can download from tinyforge. Can you please upload and share your translationfile? It would be a great contribution! Or send it to me via email and I upload it after I checked it.

Thank's in advance!

knerz


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 11, 2007 4:11 pm 
Offline

Joined: Tue Oct 24, 2006 10:43 am
Posts: 591
Quote:
6. you can change the font name in .xsl to your chinese font name, Simsun,...., make sure your editor encoding is utf-8.


Now I got it. You mean you must change the font name, and not only in the xsl- but also in the rml-files. Then all my other prints are showing Chinese characters correctly. There are a lot of xsl- and rml- files to change so I write a few short commands to change them all at once (Linux):

Code:
find ~/tinyerp-server-4.0.2/bin/addons -name "*.rml" | xargs grep -l Times-Roman | xargs sed -i s/Times-Roman/SimSun/g

find ~/tinyerp-server-4.0.2/bin/addons -name "*.rml" | xargs grep -l Times-BoldItalic | xargs sed -i s/Times-BoldItalic/SimSun/g

find ~/tinyerp-server-4.0.2/bin/addons -name "*.rml" | xargs grep -l Times-Bold | xargs sed -i s/Times-Bold/SimSun/g

find ~/tinyerp-server-4.0.2/bin/addons -name "*.rml" | xargs grep -l Times-Italic | xargs sed -i s/Times-Italic/SimSun/g

find ~/tinyerp-server-4.0.2/bin/addons -name "*.rml" | xargs grep -l Helvetica-BoldOblique | xargs sed -i s/Helvetica-BoldOblique/SimHei/g

find ~/tinyerp-server-4.0.2/bin/addons -name "*.xsl" | xargs grep -l Helvetica-BoldOblique | xargs sed -i s/Helvetica-BoldOblique/SimHei/g

find ~/tinyerp-server-4.0.2/bin/addons -name "*.rml" | xargs grep -l Helvetica-Bold | xargs sed -i s/Helvetica-Bold/SimHei/g

find ~/tinyerp-server-4.0.2/bin/addons -name "*.xsl" | xargs grep -l Helvetica-Bold | xargs sed -i s/Helvetica-Bold/SimHei/g

find ~/tinyerp-server-4.0.2/bin/addons -name "*.xsl" | xargs grep -l Helvetica-Oblique | xargs sed -i s/Helvetica-Oblique/SimHei/g

find ~/tinyerp-server-4.0.2/bin/addons -name "*.rml" | xargs grep -l Helvetica | xargs sed -i s/Helvetica/SimHei/g

find ~/tinyerp-server-4.0.2/bin/addons -name "*.xsl" | xargs grep -l Helvetica | xargs sed -i s/Helvetica/SimHei/g

find ~/tinyerp-server-4.0.2/bin/addons -name "*.rml" | xargs grep -l Courier-Bold | xargs sed -i s/Courier-Bold/SimYou/g

find ~/tinyerp-server-4.0.2/bin/addons -name "*.xsl" | xargs grep -l Courier | xargs sed -i s/Courier/SimYou/g

find ~/tinyerp-server-4.0.2/bin/addons -name "*.rml" | xargs grep -l Courier | xargs sed -i s/Courier/SimYou/g


The only used fonts in the unchanged standard-installation are Times-Roman, Times-BoldItalic, Times-Bold, Times-Italic, Helvetica-BoldOblique, Helvetica-Bold, Helvetica, Courier-Bold and Courier. In this example I changed all Times to SimSun, Helvetica to SimHei and Courier to SimYou, but you can change them to different Chinese-capable fonts of course. But you have to have the font and have added it as vcc decribed above.

knerz


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 18, 2007 6:56 am 
Offline

Joined: Sun May 13, 2007 4:43 pm
Posts: 26
after i trying the step above.
The whole program is unable to run.
Is there a step by step guild?
i am new to linux.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 18, 2007 8:39 am 
Offline

Joined: Tue Oct 24, 2006 10:43 am
Posts: 591
Step by Step:

1. get a Chinese-capable true-type-font (for me now arialuni.ttf (Full name: "Arial Unicode MS") does the job)
2. copy it to the folder tiny/bin/reportlab/fonts/
3. edit tiny/report/render/rml2pdf/trml2pdf.py, write this (starting at the top where you can set the encoding):

Code:
encoding = 'UTF-8'


from reportlab.lib.enums import TA_LEFT, TA_RIGHT, TA_CENTER, TA_JUSTIFY

from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle, StyleSheet1



def getZhSampleStyleSheet():

    """Returns a chinese stylesheet object"""

    stylesheet = StyleSheet1()
    stylesheet.add(ParagraphStyle(name='Normal',
                                  fontName='Arial Unicode MS',
                                  fontSize=10,
                                  leading=12)
                   )
    stylesheet.add(ParagraphStyle(name='BodyText',
                                  parent=stylesheet['Normal'],
                                  spaceBefore=6)
                   )
    stylesheet.add(ParagraphStyle(name='Italic',
                                  parent=stylesheet['BodyText'],
                                  fontName = 'Arial Unicode MS')
                   )
    stylesheet.add(ParagraphStyle(name='Heading1',
                                  parent=stylesheet['Normal'],
                                  fontName = 'Arial Unicode MS',
                                  fontSize=18,
                                  leading=22,
                                  spaceAfter=6),
                   alias='h1')

    stylesheet.add(ParagraphStyle(name='Title',
                                  parent=stylesheet['Normal'],
                                  fontName = 'Arial Unicode MS',
                                  fontSize=18,
                                  leading=22,
                                  alignment=TA_CENTER,
                                  spaceAfter=6),
                   alias='title')
    stylesheet.add(ParagraphStyle(name='Heading2',
                                  parent=stylesheet['Normal'],
                                  fontName = 'Arial Unicode MS',
                                  fontSize=14,
                                  leading=18,
                                  spaceBefore=12,
                                  spaceAfter=6),
                   alias='h2')
    stylesheet.add(ParagraphStyle(name='Heading3',
                                  parent=stylesheet['Normal'],
                                  fontName = 'Arial Unicode MS',
                                  fontSize=12,
                                  leading=14,
                                  spaceBefore=12,
                                  spaceAfter=6),
                   alias='h3')
    stylesheet.add(ParagraphStyle(name='Bullet',
                                  parent=stylesheet['Normal'],
                                  firstLineIndent=0,
                                  spaceBefore=3),
                   alias='bu')
    stylesheet.add(ParagraphStyle(name='Definition',
                                  parent=stylesheet['Normal'],
                                  firstLineIndent=0,
                                  leftIndent=36,
                                  bulletIndent=0,
                                  spaceBefore=6,
                                  bulletFontName='Arial Unicode MS'),
                   alias='df')
    stylesheet.add(ParagraphStyle(name='Code',
                                  parent=stylesheet['Normal'],
                                  fontName='Arial Unicode MS',
                                  fontSize=8,
                                  leading=8.8,
                                  firstLineIndent=0,
                                  leftIndent=36))
    return stylesheet


4. in the same file search for reportlab.lib.styles.getSampleStyleSheet() and replace it by getZhSampleStyleSheet() (6 times).

5. edit tiny/report/render/rml2pdf/__init__.py, write this:
Code:
from reportlab.lib.fonts import addMapping
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
from reportlab.pdfbase.cidfonts import CIDFont, findCMapFile
from reportlab.lib.fonts import addMapping

pdfmetrics.registerFont(TTFont('Arial Unicode MS','arialuni.ttf'))

for facename in ['Arial Unicode MS']:
   addMapping(facename, 0, 0, facename)    #normal
   addMapping(facename, 0, 1, facename)    #italic
   addMapping(facename, 1, 0, facename)    #bold
   addMapping(facename, 1, 1, facename)    #italic and bold


6. go to your tiny-folder. change all the reports so they use Arial Unicode MS as font by typing these 14 commands:
Code:
find ./bin/addons -name "*.rml" | xargs grep -l 'Times-Roman' | xargs sed -i 's/Times-Roman/Arial Unicode MS/g';
find ./bin/addons -name "*.rml" | xargs grep -l 'Times-BoldItalic' | xargs sed -i 's/Times-BoldItalic/Arial Unicode MS/g';
find ./bin/addons -name "*.rml" | xargs grep -l 'Times-Bold' | xargs sed -i 's/Times-Bold/Arial Unicode MS/g';
find ./bin/addons -name "*.rml" | xargs grep -l 'Times-Italic' | xargs sed -i 's/Times-Italic/Arial Unicode MS/g';
find ./bin/addons -name "*.rml" | xargs grep -l 'Helvetica-BoldOblique' | xargs sed -i 's/Helvetica-BoldOblique/Arial Unicode MS/g';
find ./bin/addons -name "*.xsl" | xargs grep -l 'Helvetica-BoldOblique' | xargs sed -i 's/Helvetica-BoldOblique/Arial Unicode MS/g';
find ./bin/addons -name "*.rml" | xargs grep -l 'Helvetica-Bold' | xargs sed -i 's/Helvetica-Bold/Arial Unicode MS/g';
find ./bin/addons -name "*.xsl" | xargs grep -l 'Helvetica-Bold' | xargs sed -i 's/Helvetica-Bold/Arial Unicode MS/g';
find ./bin/addons -name "*.xsl" | xargs grep -l 'Helvetica-Oblique' | xargs sed -i 's/Helvetica-Oblique/Arial Unicode MS/g';
find ./bin/addons -name "*.rml" | xargs grep -l 'Helvetica' | xargs sed -i 's/Helvetica/Arial Unicode MS/g';
find ./bin/addons -name "*.xsl" | xargs grep -l 'Helvetica' | xargs sed -i 's/Helvetica/Arial Unicode MS/g';
find ./bin/addons -name "*.rml" | xargs grep -l 'Courier-Bold' | xargs sed -i 's/Courier-Bold/Arial Unicode MS/g';
find ./bin/addons -name "*.xsl" | xargs grep -l 'Courier' | xargs sed -i 's/Courier/Arial Unicode MS/g';
find ./bin/addons -name "*.rml" | xargs grep -l 'Courier' | xargs sed -i 's/Courier/Arial Unicode MS/g'


finished.

knerz


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 18, 2007 7:42 pm 
Offline

Joined: Sun May 13, 2007 4:43 pm
Posts: 26
Hi knerz, first of all, thanks for your help.

Can you send me the true type fonts? As i don't have a window. and i don't know where to download it.
my email : lanevoiiv@hotmail.com thanks alot.

1) after you i receive the ttf file. i copy it by draging in to the folder of tinyerp-server/bin/reportlab/fonts/ and put it anywhere inside the fonts folder.

2) edit tiny/report/render/rml2pdf/trml2pdf.py
type the comment in terminal : sudo vi /tinyerp-server/report/render/rml2pdf/trml2pdf.py
when opened the file. i copy the code you pasted above from the top of the file. and save it.

3) How do i search the file reportlab.lib.styles.getSampleStyleSheet() ?
if i found the file as mention. Replace it by getZhSampleStyleSheet() mean change the file name as mentioned :getZhSampleStyleSheet? what the meaning 6times?

4) edit tiny/report/render/rml2pdf/_init_.py using the comment vi.
and copy the code you paste above. start from top of the file opened in vi right. after that save it.

5) go to the tinyerp-server folder and change everything by typing the 14 commands.
find ./bin/addons -name "*.rml" | xargs grep -l 'Times-Roman' | xargs sed -i 's/Times-Roman/Arial Unicode MS/g';
etc....

is that correct?
can you advise me how can i edit using vi?
because i can't type anything in vi or save anything?
i read the man vi. but don't really understand it, i am sorry for troubling you.

i try to find reportlab.lib.styles.getSampleStyleSheet() but don't really find it. is it in the tinyerp-server folder? please advise.

thanks alot for your afford and sorry for the trouble costing you.

alex


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 22, 2007 12:02 pm 
Offline

Joined: Sun May 13, 2007 4:43 pm
Posts: 26
[/code]Unhandled exception in thread started by <function>
Traceback (most recent call last):
File "/usr/lib/python2.4/site-packages/tinyerp-server/service/web_services.py", line 407, in go
(result, format) = obj.create(cr, uid, ids, datas, context)
File "/usr/lib/python2.4/site-packages/tinyerp-server/report/report_sxw.py", line 306, in create
pdf = create_doc(rml2)
File "/usr/lib/python2.4/site-packages/tinyerp-server/report/interface.py", line 170, in create_pdf
obj.render()
File "/usr/lib/python2.4/site-packages/tinyerp-server/report/render/render.py", line 56, in render
result = self._render()
File "/usr/lib/python2.4/site-packages/tinyerp-server/report/render/rml.py", line 41, in _render
return rml2pdf.parseString(self.xml, images=self.bin_datas, path=self.path)
File "/usr/lib/python2.4/site-packages/tinyerp-server/report/render/rml2pdf/trml2pdf.py", line 706, in parseString
r.render(fp)
File "/usr/lib/python2.4/site-packages/tinyerp-server/report/render/rml2pdf/trml2pdf.py", line 250, in render
self.styles = _rml_styles(el)
File "/usr/lib/python2.4/site-packages/tinyerp-server/report/render/rml2pdf/trml2pdf.py", line 142, in __init__
self.styles[style.getAttribute('name')] = self._para_style_get(style)
File "/usr/lib/python2.4/site-packages/tinyerp-server/report/render/rml2pdf/trml2pdf.py", line 205, in _para_style_get
styles = reportlab.lib.styles.getZhSampleStyleSheet()
AttributeError: 'module' object has no attribute 'getZhSampleStyleSheet'
Quote:
Hi, after i complete all the step above, i have the following error, do you know where i went wrong? thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 22, 2007 12:20 pm 
Offline

Joined: Sun May 13, 2007 4:43 pm
Posts: 26
I just found out that i forgot to change the getZhStyleSample.
now is ok.
but the problem is, when i want to print chinese fonts, it is still the same.
????? can not see the chinese?
any help, thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 23, 2007 7:16 pm 
Offline

Joined: Sun May 13, 2007 4:43 pm
Posts: 26
after following all the step... i can print with chinese character now.
but how can i have a full chinese interfaces?
can anyone help, thanks.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next

All times are UTC + 2 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:

Protected by Anti-Spam ACP