Search code examples
htmlpdfhtml-tablerst2pdf

Embedding HTML in an rst2pdf list-table


I'm using rst2pdf 0.92 on linux, and I am trying to embed html inside a list-table directive, as shown in Dimitri Christodoulou's blog. Robert Alsina mentioned that he had integrated this feature into rst2pdf 0.90.

I'm trying to build an invoice with multiple text lines per cell, the simplest way to control where the line-breaks are seems to be using a <br> tag. This was my test.rst file:

Invoice for Services Rendered
=============================

.. list-table::
   :widths: 50 50
   :header-rows: 0

   * - .. raw:: html

         <p>My Name Here<br>My address here<br>City, State, Zip<br>Ph: 214-555-1212<br></p>

     - **INVOICE**
   * - This is a test
     - .. raw:: html

         <p>Invoice #20120622001<br>Date: 25 June 2012<br></p>

This compiles into a pdf with no problems using rst2pdf -o test.pdf test.rst; however, I see no text where the embedded HTML should be:

rst2pdf with embedded html: broken

I am using:

  • Python 2.6.6 in a virtual-env
  • docutils 0.9.1
  • rst2pdf 0.92
  • xhtml2pdf 0.0.4
  • Debian Squeeze (Debian Linux 6.0)

How can I get rst2pdf to embed the HTML shown above in a list-table directive?

EDIT

This has been filed as rst2pdf issue 455


Solution

  • Fixed it! Sorry it took so long. Latest pisa/xhtml2pdf has completely different imports :-P