also posted issue on pyfpdf site
http://code.google.com/p/pyfpdf/issues/detail?id=54&thanks=54&ts=1367007819
2013 m. balandis 26 d., penktadienis 23:17:41 UTC+3, Jurgis Pralgauskis
rašė:
>
> ok, SOLVED ttf issue for unicode example
> http://code.google.com/p/pyfpdf/wiki/Unicode
> just needed t
ok, SOLVED ttf issue for unicode example
http://code.google.com/p/pyfpdf/wiki/Unicode
just needed to create directorygluon > contrib > fpdf > font
and place needed ttf files insited it :)
then pdf.write(8, u"Ąžuolas") works fine
BUT - how to make it work with write_html(...) ?
write_h
Hi,
but this seems to work not for all unicode characters
like if I have "Ąžuolas"
u"Ąžuolas".encode('iso-8859-1') gives error :/
UnicodeEncodeError: 'latin-1' codec can't encode characters in position 0-1:
ordinal not in range(256)
2011 m. balandis 29 d., penktadienis 06:35:40 UTC+3, Alex
The same can be converted to a function, to make it easier:
def lt(str):
return unicode(str,'utf-8').encode('iso-8859-1')
so just
pdf.cell(50,20,lt('Helló Wórld'), 0,2,'L')
2011/4/29 Christopher Steel
>
> This solution works well. You will need to make a minor correction and
> remove the
This solution works well. You will need to make a minor correction and
remove the single quotes around 'txt' in the second line. The edited
version looks like this:
txt = 'Hélló wórld'
utxt = unicode(txt, 'utf-8')
stxt = utxt.encode('iso-8859-1')
pdf.cell(50,20, stxt, 0, 2, 'L')
5 matches
Mail list logo