简体   繁体   English

是否有使用xhtml2pdf python模块的当前教程或howto文档?

[英]Is there a current tutorial or howto document for using the xhtml2pdf python module?

I can't seem to find a working tutorial or howto document for this module. 我似乎无法找到这个模块的工作教程或如何文档。 Does one exist somewhere? 某人存在吗?


The "To be completed" section here: https://github.com/chrisglass/xhtml2pdf/blob/master/doc/usage.rst 这里的“待完成”部分: https//github.com/chrisglass/xhtml2pdf/blob/master/doc/usage.rst

is buggy, and doesn't seem to contain working code. 是有缺陷的,似乎不包含工作代码。 After corrections, this code sequence: 更正后,此代码序列:

from xhtml2pdf import pisa as pisa
filename = u'test.pdf'
pdf = pisa.CreatePDF("Hello <strong>World</strong>",file(filename, "wb"))
pisa.startViewer(filename)

produces an empty test.pdf file (well, not exactly empty, it's a pdf file without content) 生成一个空的test.pdf文件(好吧,不完全是空的,它是一个没有内容的pdf文件)

Since it is heavily ReportLab based you may find their tutorials useful. 由于它基于ReportLab,因此您可能会发现它们的教程非常有用。

(I don't use either package). (我不使用任何一个包)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM