[reportlab-users] Tabular Form w/Platypus
Sebastian Ware
sebastian at urbantalk.se
Fri Oct 12 13:49:21 EDT 2007
I think you need to specify at least your first page. Otherwise the
document doesn't know what a page looks like. This is what my pages
look like:
def myFirstPage(self, canvas, doc):
canvas.saveState()
canvas.setFont('Times-Bold',16)
canvas.drawCentredString(self.PAGE_WIDTH/2.0,
self.PAGE_HEIGHT-108, self.context.title)
canvas.setFont('Times-Roman',9)
canvas.drawString(cm, 0.75 * cm, "First Page")
canvas.restoreState()
def myLaterPages(self, canvas, doc):
canvas.saveState()
canvas.setFont('Times-Roman',9)
canvas.drawString(cm, 0.75 * cm, 'CompanyName | %d' %
(doc.page))
canvas.restoreState()
And then I call...
doc.build(story, onFirstPage=self.myFirstPage,
onLaterPages=self.myLaterPages)
...but you could probably skip "def myLaterPages" and only write...
doc.build(story, onFirstPage=self.myFirstPage)
Mvh Sebastian
12 okt 2007 kl. 19.35 skrev Rich Shepard:
> On Fri, 12 Oct 2007, Sebastian Ware wrote:
>
>> You can't just add text, you need to add flowables. Story is a
>> list of flowables.
>
> Sebastian,
>
> Understand the concepts, still working on the implementation
> details.
>
>> You would probably want to try story.append(Paragraph("Economic
>> Component Pairs", normal))
>
> OK.
>
>> To learn more about how things work, take a look in the ReportLab
>> User
>> Guide and Graphics Guide. I learnt the basics there. Also, take a
>> look at
>> the tests. They aren't easy to comprehend, but do help if you have
>> some
>> patience
>
> I've read the User Guide many times, looked at the tests, demos,
> and other
> example data. Translating these different examples to my needs is
> where I
> keep missing the point.
>
> For example, in doctemplate.py, lines 950-951 are:
>
> SimpleDocTemplate('doctemplate.pdf').build(objects_to_draw,
> onFirstPage=myFirstPage,onLaterPages=myLaterPages)
>
> I haven't defined myFirstPage and myLaterPages because these are
> one-page
> reports. Leaving them out of the build arguments produces that
> string of
> errors terminating in AttributeError: 'function' object has no
> attribute 'getKeepWithNext'.
>
> Thanks,
>
> Rich
>
> --
> Richard B. Shepard, Ph.D. | The Environmental
> Permitting
> Applied Ecosystem Services, Inc. | Accelerators(TM)
> <http://www.appl-ecosys.com> Voice: 503-667-4517 Fax:
> 503-667-8863
> _______________________________________________
> reportlab-users mailing list
> reportlab-users at reportlab.com
> http://two.pairlist.net/mailman/listinfo/reportlab-users
More information about the reportlab-users
mailing list