[reportlab-users] Embedding Platypus Story in Canvas
Rich Shepard
rshepard at appl-ecosys.com
Wed Nov 7 09:45:10 EST 2007
On Tue, 6 Nov 2007, Tim Roberts wrote:
> Then, when you call it, pass in the canvas:
>
> myCanvas = canvas.Canvas( 'input_variables.pdf', pagesize=LETTER )
> doc = MyTemplate( None, canvas )
Tim,
I think that I'm trying to push water up hill. The error message from the
above is
Traceback (most recent call last):
File "eikos.py", line 150, in OnProjParms
projectReports().inputVals()
File "/data1/eikos/reports.py", line 122, in inputVals
doc = MyTemplate(None,canvas)
TypeError: __init__() takes exactly 2 arguments (3 given)
But, if I remove 'None', then doc.build(story) cannot find the page size.
Sigh.
> However, if you don't need to override anything, why don't you just let
> the template create the canvas and pull it out later?
I tried this yesterday but did not discover the correct way to do it.
Perhaps the most pragmatic thing for me to do is to stop trying to begin
the report with a platypus cover page and have all the following pages write
directly to the canvas, and re-write the cover page without platypus. The
only reason to use platypus is that one database table attribute -- the
project description -- can be a variable length string, and that's handled
easily by a paragraph in a table cell. But, despite your patient help, three
days of focused work on this one issue leaves it unresolved. Three days ago,
you suggested that I split that one string on the white space, track the
string width and compare that to the assigned room for it, then manually
move the X and Y coordinates to write the next line until the string is
completed. While this involves a lot of detailed manipulation and
setting/getting x and y coordinates, it will probably be quicker than
continuing down this path. Since the entire report will be done in a single
ReportLab mode it should be easier to have it work with minimal adjustment.
Perhaps I was trying to do something not in the overall ReportLab design.
Thanks very much,
Rich
--
Richard B. Shepard, Ph.D. | Integrity Credibility
Applied Ecosystem Services, Inc. | Innovation
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863
More information about the reportlab-users
mailing list