No, the "em" still raises an AttributeError. In the post above, I've included all the code to duplicate the problem...
On Monday, July 16, 2012 4:17:48 PM UTC-4, Derek wrote: > > Try to use "em", see if you still get the same problem. > > 1em = 12pt > > http://www.getallfix.com/2011/11/convert-empxpt-and-in-css/ > > On Monday, July 16, 2012 1:08:13 PM UTC-7, thinkwell wrote: >> >> Well, me again. I decided that I wanted to use points as measurements >> instead of percentages, so now it barfs with an AttributeError. >> >> >> from gluon.contrib.pyfpdf import FPDF, HTMLMixin >> from gluon.html import * >> >> >> pets = TABLE(_width="720pt") >> pets.append(TR(TH('Dogs', _width="72pt", >> _align="left"),TH("Cats",_width="72pt", >> _align="left"),TH('Snakes',_width="72pt", _align="left"))) >> pets.append(TR('Collies','Tabby','Python', _width="60pt")) >> pets.append(TR('Akitas', 'Persian', 'Garter')) >> pets.append(TR('German Shepherds', 'Alley Cats', 'Rattlesnakes')) >> >> >> class MyFPDF(FPDF, HTMLMixin): >> pass >> >> pdf=MyFPDF() >> #First page >> pdf.add_page() >> pdf.write_html(pets.xml()) >> pdf.output('html2.pdf','F') >> >> >> This is clearly unremarkable HTML, but no, I get tracebacks like so: >> >> Traceback (most recent call last): >> File "pyfpdf_test.py", line 73, in <module> >> pdf.write_html(pets.xml()) >> File "/home/dave/PythonTraining/web2py/gluon/contrib/pyfpdf/html.py", >> line 388, in write_html >> h2p.feed(text) >> File "/usr/lib/python2.7/HTMLParser.py", line 114, in feed >> self.goahead(0) >> File "/usr/lib/python2.7/HTMLParser.py", line 158, in goahead >> k = self.parse_starttag(i) >> File "/usr/lib/python2.7/HTMLParser.py", line 324, in parse_starttag >> self.handle_starttag(tag, attrs) >> File "/home/dave/PythonTraining/web2py/gluon/contrib/pyfpdf/html.py", >> line 241, in handle_starttag >> self.pdf.set_x(self.table_offset) >> AttributeError: HTML2FPDF instance has no attribute 'table_offset' >> >> I find this remarkable; this ordinary HTML; web2py encourages the use of >> HTML helpers. web2py is easy to use, requires few dependencies, etc. etc. >> But what a *fight* to create a simple table-based PDF! :-( And I'm still >> experimenting in the layout stage. My final report will be much larger and >> include nested tables *(that are already rendering fine in HTML, but not >> in pyfpdf / html2pdf)*. >> >> Should I bite the bullet and install Reportlab? It'll be harder to get >> started, more complicated to install & maintain (this will have to go on >> multiple machines). The idea of a simple web2py project was very attractive >> for these reasons. >> >> Are others out there creating PDFs from HTML with pyfpdf & html2pdf?? >> > --