[reportlab-users] Paragraph, text and spaces

Peter Milliken peter.milliken at gmail.com
Thu Jul 1 19:17:00 EDT 2010


Still playing with reportlab :-)

I am trying to print strings of text using Paragraph. These strings are
lines of code listings so they include spaces to show indentation (spaces -
not tabs). When I 'print' the document all of the spacing/ indentation has
been removed! i.e.

if test:
print 'here'
else:
print 'there'

comes out as:

if test:
print 'here'
else:
print 'there'

The description for Paragraph states:

"The following text creates an instance of the Paragraph class:
Paragraph(text, style, bulletText=None)
The text argument contains the text of the paragraph; excess white space is
removed from the text at the
ends and internally after linefeeds."

I am more than happy with excess white space removed from the end of the
line of text, but why am I seeing white space removed from the beginning? it
certainly doesn't tie in with the rest of the description for Paragraph that
states:

"This allows easy use of indented triple quoted text in Python scripts."

because when I attempted to "print" an indented triple quoted Python comment
it also saw the leading spaces removed!

Any help of what I am doing wrong would be greatly appreciated!

Thanks
Peter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20100702/b1ae459a/attachment.html>


More information about the reportlab-users mailing list