Tamil PDF Generation

50 views
Skip to first unread message

Gopalasivam

unread,
Oct 27, 2009, 6:26:39 AM10/27/09
to jagpdf
Dear All,
I was trying to write a python program to generate PDF in tamil
language with JAGPDF.
The code is given below...

import jagpdf
doc = jagpdf.create_file("test.pdf")
doc.page_start(597.6,848.68)
can = doc.page().canvas()
can.text(50,760,"ஆங்கிலம")
dejavu = doc.font_load("file=lohit_ta.ttf; size=14")
can.text_font(dejavu)
doc.page_end()
doc.finalize()

when i executing the code .i m getting the following error...

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/var/lib/python-support/python2.5/jagpdf.py", line 73, in
finalize
def finalize(*args): return _jagpdf.Document_finalize(*args)
jagpdf.Exception: 06-30013 Cannot output font Lohit Tamil.
06-30014 Font referenced but no characters were used.

How to solve this error..?

Thanks in Advance,
Gopalasivam

Jarda Grešula

unread,
Oct 27, 2009, 7:35:59 AM10/27/09
to jagpdf
Hi,

you have to set lohit_ta.ttf as the current font before showing text
in tamil. Your code performs these operations in reverse order. Try
this:

# set the current font
font = doc.font_load("file=lohit_ta.ttf; size=14")
can.text_font(font)

# show text using lohit_ta.ttf
can.text(50,760,"ஆங்கிலம")

regards,
--
Jarda
Reply all
Reply to author
Forward
0 new messages