Closed GoogleCodeExporter closed 9 years ago
Original comment by sundou19...@gmail.com
on 28 Jan 2014 at 7:17
Attachments:
Thanks for reporting!
The problem is solved (copying here from the original post so it will be more
clear):
1. Adding the unicode font in reportsStart.py header:
class PDFfromHTML(FPDF, HTMLMixin):
current.response.pageheader = "A Simple Page Header"
#page header
def header(self):
self.set_y(10)
self.add_font('DejaVuSans','','DejaVuSans.ttf',uni=True)
self.add_font('DejaVuSans','B','DejaVuSans-Bold.ttf',uni=True)
self.set_font('DejaVuSans','',10)
...etc...(note the 'B' in the second adding)
2. Wrapping the table object generated in simpleListingFpdf() of the
pdfReport.py controller around TAG.FONT(), using the said DejaVuSans font:
def simpleListingFpdf():
.......................
.......................
if request.extension == "pdf":
from reportsStart import PDFfromHTML
pdfReport = PDFfromHTML()
current.response.title = "web2py Report: Δοκιμή (Test)"
pdfReport.add_page()
pdfReport.add_font('DejaVuSans','','ARIALUNI.TTF',uni=True)
pdfReport.set_font('DejaVuSans','',14)
html = TAG.FONT(table, _face="DejaVuSans", )
response.headers['Content-Type']='text/html'
pdfReport.write_html(html.xml())
response.headers['Content-Type']='application/pdf'
return pdfReport.output(dest='S')
# else return normal html view:
return dict(table=table)
Original comment by reingart@gmail.com
on 5 Feb 2014 at 1:45
Issue 52 has been merged into this issue.
Original comment by reingart@gmail.com
on 5 Feb 2014 at 4:23
Original issue reported on code.google.com by
t_gleza...@yahoo.com
on 13 Dec 2013 at 9:21