Thanks a lot for example. It didn't work but I found a solution with
work. After some modifications:
from xhtml2pdf.pisa import CreatePDF, startViewer
from tg.render import render as render_template
import cStringIO
html = render_template({"param1": 1, "param2": 2}, "genshi",
"
myapp.templates.page", doctype=None)
dest = '/home/user/files/pdf/test.pdf'
result = file(dest, "wb")
pdf = CreatePDF(cStringIO.StringIO(html), result)
result.close()
import paste.fileapp
f = paste.fileapp.FileApp('/home/user/files/pdf/test.pdf')
from tg import use_wsgi_app
return use_wsgi_app(f)
It's work fine without national characters but with it in template
it's returning the error:
UnicodeEncodeError: 'ascii' codec can't encode character u'\u0119' in
position 2497: ordinal not in range(128)
I have in my script:
# -*- coding: utf-8 -*-
and also in template:
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"
py:if="False"/>
How can I set default encoding to utf-8 for render? Or is there any
other solution?
please help
2012/6/20 Alessandro Molina <
alessand...@gmail.com>: