[reportlab-users] Confused? SimpleDocTemplate?

Schollnick, Benjamin reportlab-users@reportlab.com
Fri, 20 Feb 2004 10:33:08 -0500


Folks,

	Have I missed something?

	I usually just make a canvas, and DrawStringText...
	But for the report generator that I am making, I can't 
	pre-determine the size of the document...

	So I thought I would use a template...

	But I don't see where or how, you can set the Document/page
	size via the SimpleDocTemplate?

	For example,  the GFE example in ../demos/Gadfly...

def myFirstPage(canvas, doc):
    canvas.saveState()
    #canvas.setStrokeColorRGB(1,0,0)
    #canvas.setLineWidth(5)
    #canvas.line(66,72,66,PAGE_HEIGHT-72)
    canvas.setFont('Times-Bold',16)
    canvas.drawString(108, PAGE_HEIGHT-108, Title)
    canvas.setFont('Times-Roman',9)
    canvas.drawString(inch, 0.75 * inch, "First Page / %s" % pageinfo)
    canvas.restoreState()

def myLaterPages(canvas, doc):
    #canvas.drawImage("snkanim.gif", 36, 36)
    canvas.saveState()
    #canvas.setStrokeColorRGB(1,0,0)
    #canvas.setLineWidth(5)
    #canvas.line(66,72,66,PAGE_HEIGHT-72)
    canvas.setFont('Times-Roman',9)
    canvas.drawString(inch, 0.75 * inch, "Page %d %s" % (doc.page,
pageinfo))
    canvas.restoreState()

def go():
    Elements.insert(0,Spacer(0,inch))
    doc = SimpleDocTemplate('gfe.pdf')
    doc.build(Elements,onFirstPage=myFirstPage, 
			onLaterPages=myLaterPages)

It appears we are declaring the SimpleDocTemplate, with the filename, but I
do not see in the documentation any initialization options for the pagesize?

I have gone through the API reference, and users guide..  But still have not
found any method to do this...  

Any assistance would be appreciated...

		- Benjamin