[reportlab-users] Flowables

Brandon Rich brich at caseta.com
Tue Jan 15 15:18:20 EST 2008

Here is the code that I am currently using.

def createDoc( self, buffer):
# Generate the PDF
doc = SimpleDocTemplate( buffer, pagesize = letter, leftMargin = 0.5*inch, rightMargin = 0.5*inch, bottomMargin = 1.5*inch )
contents = [ Spacer( 1, 0.15*inch ) ]
Template (violation, searchList= [{'name' : 'Tim'}]).respond()
paragraphStyle = get_stylesheets()['Normal']
p = Paragraph( Template ,paragraphStyle,None)
contents.append( p )
contents.append( PageBreak())
contents.append( Spacer( 1, 0.15*inch ) )
doc.build( contents, onFirstPage=self.firstPage, onLaterPages=self.otherPages )
return (buffer)

And the error...

File "C:\workspace\pythonlibs\tests\document\pdfutil.py", line 91, in createDoc
Template (violation, searchList= [{'name' : 'Tim'}]).respond()
File "c:\python25\lib\site-packages\cheetah-2.0-py2.5.egg\Cheetah\Template.py", line 1151, in __init__
raise TypeError(reason) TypeError: arg 'source' must be string or None

-----Original Message-----
From: reportlab-users-bounces at reportlab.com [mailto:reportlab-users-bounces at reportlab.com] On Behalf Of Tim Roberts
Sent: Tuesday, January 15, 2008 12:23 PM
To: Support list for users of Reportlab software
Subject: Re: [reportlab-users] Flowables

Brandon Rich wrote:


> I am trying to create a PDF that is currently being passed a paragraph

> flowable. While it is working currently, I have created a cheetah

> template that I want to use to replace the “text” argument in the

> flowable. Since I am trying to pass a string to the text argument, I

> am getting an error and cannot figure out another way to get around

> this.




> Any ideas?


It is always easier to diagnose these kinds of things if you include the
exact code you used, and the exact error you got. Otherwise, it could
be anything from a typographical error to a usage problem.

Template.respond() returns a normal string, and you should be able to
pass that directly to Paragraph to produce a flowable.

Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.

reportlab-users mailing list
reportlab-users at reportlab.com

More information about the reportlab-users mailing list