[reportlab-users] Bulleted text

Saketh Bhamidipati saketh.bhamidipati at gmail.com
Wed Jun 28 15:55:29 EDT 2006


I am having great difficulty trying to write bulleted text to a PDF file via
ReportLab. The document should have a title, and two columns below it - the
left for headings and the right for bulleted text. I'm not having much of a
problem with the title, but writing the headings and the bulleted text is
confusing.

Basically, the class that writes the PDF takes a multi-line string of text,
and writes it to the right column. Within this text parameter, there are
asterisks - these asterisks are to be replaced by bullets. So, for instance:

* Testing.
* Still testing.
* Testing, testing,
testing.
* Testing even more.

should be replaced by (this time with bullets):

   - Testing.
   - Still testing.
   - Testing, testing, testing.
   - Testing even more.

I've tried everything for the bullets, and the only thing that works is
u'\N{BULLET}'. However, I cannot replace the asterisks with u'\N{BULLET}'
because Python does not natively use Unicode. What I want is something like
text.replace('*', u'\N{BULLET}'), but that doesn't work.

In addition, how can I make it so that I only have to call setTextOrigin
once, and successive calls to drawText() will append the text?

For example, after one drawText():
This is a text.

After a second drawText():
This is a text.
This is a second text.

And so on. If it runs over the page, it should go onto the next page. I
don't understand how to do this in ReportLab right now without calling
setTextOrigin over and over.

So, in summary, here are my two questions:

   1. How can I turn asterisks in a text into bullets, and draw the
   bullets to the canvas?
   2. How can I make drawText append the text to the end of the last
   drawText, and go to the next page if necessary?

Thank you in advance for the assistance! It is greatly appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://two.pairlist.net/pipermail/reportlab-users/attachments/20060628/d5379e57/attachment.htm


More information about the reportlab-users mailing list