【问题标题】:Embedding HTML in an rst2pdf list-table在 rst2pdf 列表中嵌入 HTML
【发布时间】:2012-06-25 12:18:08
【问题描述】:

我在 linux 上使用 rst2pdf 0.92,我试图将 html 嵌入到 list-table 指令中,如 Dimitri Christodoulou's blog 所示。 Robert Alsina 提到他已经将此功能集成到rst2pdf 0.90 中。

我正在尝试构建每个单元格包含多个文本行的发票,控制换行符位置的最简单方法似乎是使用 <br> 标记。这是我的test.rst 文件:

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>

使用rst2pdf -o test.pdf test.rst 可以毫无问题地编译成pdf;但是,我看不到嵌入 HTML 应该位于的文本:

我正在使用:

  • 虚拟环境中的 Python 2.6.6
  • docutils 0.9.1
  • rst2pdf 0.92
  • xhtml2pdf 0.0.4
  • Debian Squeeze (Debian Linux 6.0)

如何让 rst2pdf 将上面显示的 HTML 嵌入到 list-table 指令中?

编辑

这已被归档为rst2pdf issue 455

【问题讨论】:

    标签: html pdf html-table rst2pdf


    【解决方案1】:

    修好了!抱歉花了这么长时间。最新的 pisa/xhtml2pdf 有完全不同的导入:-P

    【讨论】:

    • xhtml2pdf 已安装,我可以将其导入 virtual_env 中。我正在编辑我的问题以包含版本...尽管如果缺少该版本,rst2pdf 不应该出现错误吗?
    • 是的,它应该记录“您需要安装 xhtml2pdf 才能使用原始 HTML 指令。”
    • 发生了一些奇怪的事情,但好消息是,它也发生在我身上,导入正在悄无声息地失败。你能为此提交一个错误吗?
    • 对修复的可行性有任何想法吗?
    • 修复了!抱歉花了这么长时间。最新的 pisa/xhtml2pdf 有完全不同的导入:-P
    猜你喜欢
    • 2012-05-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多