While creating a PDF document, I had no problem generating the perfect header
and footer, but when I passed html to your module, all styling was removed and
I was unable to successfully change the font using the <font> tags.
So everything was coming out in times new roman, therefore I made the following
changes you may want to include:
Basically I have added more fiends to the write_html() functions
e.g. pdf.write_html(text=str(XML(table,
sanitize=False)),font="arial",fontsize=11)
This way you can specify the font and size of the text you are passing through.
Changes done:
class HTMLMixin():
def write_html(self, **kwargs):
"Parse HTML and convert it to PDF"
h2p = HTML2FPDF(self,**kwargs)
h2p.feed(kwargs["text"])
class HTML2FPDF(HTMLParser):
"Render basic HTML to FPDF"
def __init__(self, pdf, image_map):
HTMLParser.__init__(self)
self.image_map = kwargs.get("image_map","")
self.set_font(kwargs.get("font","times"), kwargs.get("fontsize",12))
(removed extra code)
Please let me know if you need anything else from me.
Tyrone Hattingh
Original issue reported on code.google.com by tyrone.h...@gmail.com on 14 Sep 2011 at 2:14
Original issue reported on code.google.com by
tyrone.h...@gmail.com
on 14 Sep 2011 at 2:14