[reportlab-users] Left Margin Too Wide

Tim Roberts timr at probo.com
Mon Oct 29 20:11:31 EDT 2007

Rich Shepard wrote:

> The attached code compiles and prints. However, everything is

> centered on

> the paper instead of left-aligned. I've not figured out how to correct

> this.


> I should try to define a frame along the left half of the paper, and

> this

> might obviate the need to make the page image narrower than the physical

> paper. I need the room on the right because that's where a pre-printed

> form

> is located.

Right. If your paper is really 8.5" wide, then that's how you should
set page size. What you are doing now is leaving it to Acrobat and the
printer driver to decide how to handle the mismatch in paper sizes.
There is no way for you to control their decision making. Some printers
DO left-align, but many will center. If you need exact placement, then
you need to put in the buffers yourself.

By the way, I don't understand this:

def getTable():
t = Table(pairData,hAlign='RIGHT')
return t
def makeTableStyles():
tStyles = []
tStyles.append(TableStyle([('ALIGN', (0,0), (-1,-1), 'LEFT'),
('FONT', (0,0), (-1,-1), 'Helvetica', 9,
def run():
for style in tStyles:
e = getTable()

I'm sure this isn't what you meant. Every run through the loop is
recreating the table and replacing the value of "e". When the loop
exits, all you have is the results of the last iteration. I suspect you
meant this:

e = getTable()
for style in tStyles:

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

More information about the reportlab-users mailing list