class MyFPDF(FPDF, HTMLMixin):
pass
(...)
html = get_template('api/historico_easypdf.html').render(Context( context ))
print('done rendering')
pdf=MyFPDF()
pdf.add_page()
pdf.write_html(html)
<table border="1" cellpadding="5px">
<tr>
<td>
<span>
<b>(text ...)</b>
<u>(text ...)</u>
</span> 
<span>
<b>(text ...)</b>
<u>(text ...)</u>
</span> 
</td>
</tr>
</table>
ERROR 2015-04-02 17:26:02,810 base 72308 140735311446784 Internal Server Error: /api/pdf/historico/pre/1
Traceback (most recent call last):
File "/Users/vyscond/Tartarus/myproj/.venv/lib/python3.4/site-packages/fpdf/html.py", line 72, in handle_data
l = [self.table_col_width[self.table_col_index]]
IndexError: list index out of range
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/vyscond/Tartarus/myproj/.venv/lib/python3.4/site-packages/django/core/handlers/base.py", line 111, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Users/vyscond/Tartarus/myproj/.venv/lib/python3.4/site-packages/django/views/decorators/csrf.py", line 57, in wrapped_view
return view_func(*args, **kwargs)
File "/Users/vyscond/Tartarus/myproj/.venv/lib/python3.4/site-packages/django/views/decorators/http.py", line 41, in inner
return func(request, *args, **kwargs)
File "/Users/vyscond/Tartarus/myproj/api/genpdf.py", line 78, in historico_preliminar
pdf.write_html(html)
File "/Users/vyscond/Tartarus/myproj/.venv/lib/python3.4/site-packages/fpdf/html.py", line 401, in write_html
h2p.feed(text)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/html/parser.py", line 165, in feed
self.goahead(0)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/html/parser.py", line 216, in goahead
self.handle_data(rawdata[i:j])
File "/Users/vyscond/Tartarus/myproj/.venv/lib/python3.4/site-packages/fpdf/html.py", line 74, in handle_data
raise RuntimeError("Table column/cell width not specified, unable to continue")
RuntimeError: Table column/cell width not specified, unable to continue
Internal Server Error: /api/pdf/historico/pre/1
Traceback (most recent call last):
File "/Users/vyscond/Tartarus/myproj/.venv/lib/python3.4/site-packages/fpdf/html.py", line 72, in handle_data
l = [self.table_col_width[self.table_col_index]]
IndexError: list index out of range
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/vyscond/Tartarus/myproj/.venv/lib/python3.4/site-packages/django/core/handlers/base.py", line 111, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Users/vyscond/Tartarus/myproj/.venv/lib/python3.4/site-packages/django/views/decorators/csrf.py", line 57, in wrapped_view
return view_func(*args, **kwargs)
File "/Users/vyscond/Tartarus/myproj/.venv/lib/python3.4/site-packages/django/views/decorators/http.py", line 41, in inner
return func(request, *args, **kwargs)
File "/Users/vyscond/Tartarus/myproj/api/genpdf.py", line 78, in historico_preliminar
pdf.write_html(html)
File "/Users/vyscond/Tartarus/myproj/.venv/lib/python3.4/site-packages/fpdf/html.py", line 401, in write_html
h2p.feed(text)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/html/parser.py", line 165, in feed
self.goahead(0)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/html/parser.py", line 216, in goahead
self.handle_data(rawdata[i:j])
File "/Users/vyscond/Tartarus/myproj/.venv/lib/python3.4/site-packages/fpdf/html.py", line 74, in handle_data
raise RuntimeError("Table column/cell width not specified, unable to continue")
RuntimeError: Table column/cell width not specified, unable to continue
So i am missing some configuration over the object MyPDF or on html? .-.