Create a Multilanguage PDF in Python

Perseo mturillo at gmail.com
Tue Aug 22 14:48:44 EDT 2006


Nothing to do!
I enable test2.py and the folder with 777 permission and I write at the
top of the file the PYTHONPATH "#!/usr/bin/python" as you told me but
it doesn't works as well.

this is my organization:
www.domain.com/python/reportlab/ [all files]
www.domain.com/python/test2.py

<code>
#!/usr/bin/python

print "Content-Type: text/html\n\n"
print "Hello World"

from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
from reportlab.pdfgen import canvas

pdfmetrics.registerFont(TTFont('Verdana', 'Verdana.ttf'))
c = canvas.Canvas("pl.pdf")
c.setFont("Verdana", 12)
c.drawString(100, 600, "Witaj,
¶wiecie!".decode("iso-8859-2").encode("utf-8"))
c.showPage()
c.save()
</code>

The verdana font doesn't exist in the reportlab fonts folder. I try to
delete the rows where it is called like (registerFont, setFont) but
nothing to do.

any suggestion?!



Diez B. Roggisch wrote:
> Perseo wrote:
>
> > I can't upload in the PYTHONPATH but in a normal folder of our site.
> > Exist another way to do it?
>
> PYTHONPATH is an environment variable. You can set it to arbitrary paths,
> and python will look for module there, too. Or you modify sys.path before
> you try the import.
> 
> Diez




More information about the Python-list mailing list