用项目符号点从python生成pdf报告 [英] Producing pdf report from python with bullet points
问题描述
我想从python脚本生成一个动态pdf文档,如下图所示.每个句子都以一个要点开头,并且文本和行数取决于用户指定的内容.关于如何从python中产生任何建议或想法?我目前正在查看appy.pod和reportlab,有人知道如何产生要点吗?
I would like to produce a dynamic pdf document from a python script that looks like the image below. Each sentence starts with a bullet point, and the text and number of lines depends on what the user specifies. Any suggestions or ideas as to how I can produce this from python? I'm currently looking at appy.pod and reportlab, does anyone know how to produce the bullet points?
推荐答案
只需使用Unicode项目符号字符•
Just use the unicode bullet point character •
要在python中使用unicode字符,可以直接指定字符或使用其unicode代码点.
To use unicode characters in python, you can either specify the character directly or use its unicode code point.
u'•' == u'\u2022'
例如:
from reportlab.pdfgen import canvas
c = canvas.Canvas("test.pdf")
c.drawString(100, 100, u'\u2022 First sentence')
c.save()
这篇关于用项目符号点从python生成pdf报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!