Merge branch 'master' of github.com:web2py/web2py

This commit is contained in:
mdipierro
2014-05-22 08:12:54 -05:00
2 changed files with 11 additions and 1 deletions
+9 -1
View File
@@ -58,8 +58,16 @@ def pyfpdf_from_html(html):
pass
pdf = MyFPDF()
pdf.add_page()
# pyfpdf needs some attributes to render the table correctly:
html = sanitize(
html, escape=False) # should have better list of allowed tags
html, allowed_attributes={
'a': ['href', 'title'],
'img': ['src', 'alt'],
'blockquote': ['type'],
'td': ['align', 'bgcolor', 'colspan', 'height', 'width'],
'tr': ['bgcolor', 'height', 'width'],
'table': ['border', 'bgcolor', 'height', 'width'],
}, escape=False)
pdf.write_html(html, image_map=image_map)
return XML(pdf.output(dest='S'))