[reportlab-users] Bulleted text
Saketh Bhamidipati
saketh.bhamidipati at gmail.com
Thu Jun 29 15:44:33 EDT 2006
Here is the code that I want to retain:
Two frames:
textframe = Frame(2 * inch, 1 * inch, 5.75 * inch, 9 * inch, id = 'TF',
showBoundary = 1)
headingframe = Frame(0.5 * inch, 1 * inch, 1.5 * inch, 9 * inch, id = 'HF',
showBoundary = 1)
Page template:
def myPageTemplate(canvas, doc):
canvas.saveState()
canvas.setFont('Times-Roman', 12)
canvas.drawCentredString(PAGE_WIDTH / 2.0, PAGE_HEIGHT - 108, Title)
canvas.drawString(PAGE_WIDTH - 2 * inch, PAGE_HEIGHT - inch, Author)
canvas.setFont('Times-Roman', 10)
canvas.drawCentredString(PAGE_WIDTH / 2.0, inch / 2.0, "%d" % doc.page)
canvas.restoreState()
I need to be able to write text to the textframe, and every time I do that I
also need to write a heading to the headingframe. Unfortunately, I can't
seem to find how to combine the low-level features of ReportLab with the
high-level features of Platypus.
If I could access the canvas directly in my derived BaseDocTemplate, then I
would be able to manually write the headings and texts. However, for some
reason, the canvas is inaccessible in the BaseDocTemplate.
Here is a semi-pseudocode function that I would like to write, but I'm not
sure how to implement it:
def writeText(flowabletext, heading): # heading is a string
textframe.write(flowabletext)
headingframe.write(heading, flowabletext.getY())
This is what I need to do:
1. Retain the frames and page template that I have written - they are
what I need.
2. Make a function that writes a block of paragraphs - each paragraph
having a bullet - to the textframe, and writes a heading to the heading
frame with the same Y-coordinate as the first line of the block of
paragraphs.
I am utterly confused, as the ReportLab documentation and the examples do
not explain how to do do something like this. Assistance is greatly
appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://two.pairlist.net/pipermail/reportlab-users/attachments/20060629/769bf45d/attachment.htm
More information about the reportlab-users
mailing list