Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Producing pdf report from python with bullet points

Tags:

python

pdf

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?

enter image description here

like image 810
Osmond Bishop Avatar asked Mar 01 '13 01:03

Osmond Bishop


People also ask

How do you print bullets in Python?

For a simple unnumbered(bulleted) list use the asterisk * "*".


1 Answers

Just use the unicode bullet point character •

To use unicode characters in python, you can either specify the character directly or use its unicode code point.

u'•' == u'\u2022'

For example:

from reportlab.pdfgen import canvas

c = canvas.Canvas("test.pdf")
c.drawString(100, 100, u'\u2022 First sentence')
c.save()
like image 101
grc Avatar answered Sep 19 '22 13:09

grc