Reportlab 中的命名实体

社会演员多 python 179

原文标题Named entities in Reportlab

我刚刚了解到 Reportlab 将支持段落文本中的命名实体,如α≈。它将支持哪些实体?

这是它如何工作的示例:

from reportlab.lib.styles import getSampleStyleSheet
from reportlab.platypus import SimpleDocTemplate, Paragraph


def main():
    styles = getSampleStyleSheet()
    pdf_path = 'sketch.pdf'
    doc = SimpleDocTemplate(pdf_path)

    story = [Paragraph('Lorem ipsum! α ≈ 90°', styles['Normal']),
             Paragraph('Dolores sit amet.', styles['Normal'])]

    doc.build(story)


main()

原文链接:https://stackoverflow.com//questions/71685918/named-entities-in-reportlab

回复

我来回复
  • Don Kirkby的头像
    Don Kirkby 评论

    跟踪 Reportlab 源代码,我发现它支持 Python 的html.entities模块中的所有内容,加上它自己的 2000 多个条目列表,尽管似乎有很多重叠。

    2年前 0条评论