Create a Multilanguage PDF in Python

Perseo mturillo at gmail.com
Sun Aug 20 17:14:11 EDT 2006


Hi again,

WORKS!!! I download all I need as python + reportlab. Only 2 questions:

1. I need all of this package? because it is 6Mb!
2. How can I connect my software with MySql. In my Hosting is present
the  Python support but I don't thing that the MySQLdb is present. How
can I solve this little problem?

Thanks
Perseo


Rob Wolfe wrote:
> "Perseo" <mturillo at gmail.com> writes:
>
> > Hi guys,
> >
> > I'm disprate with the Pdf Unicode. I try to create a class using ufpdf
> > but some chars are not correct and now I would like try Python because
> > a friend tolds me that it's very powerful.
> > I need a simple script in Python that grab all Records from a MySql
> > table and print in the pdf file.
> >
> > The languages stored in my db are about 25 and they are:
> > Greek English French Hungarian Italian Lithuanian Dutch Portuguese
> > Albanian
> > Czech Danish German Spanish Estonian Finnish Irish Latvian Maltese
> > Polish Romanian
> > Russian Slovene Slovak Swedish
>
> You can give reportlab [1] a try. It has support for TrueType fonts
> and unicode translation using UTF-8. I used to use it for pdf files
> with polish chars.
>
> Some example code:
>
> <code>
> 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>
> 
> 
> [1] http://www.reportlab.org/
> 
> -- 
> HTH,
> Rob




More information about the Python-list mailing list