[reportlab-users] Line heights and PageTemplates
robin at reportlab.com
Mon Jul 3 05:14:31 EDT 2006
Saketh Bhamidipati wrote:
> Thank you for helping me out with my headings-text issue - I resolved the
> larger part of it. However, there are still a few issues that I am
> unable to
> work out.
> Now, there are two parts that I need to fix in there. First of all, the
> in NotalonPDF.appendHeading() which says "self.headings.append(Spacer(inch,
> 1 * self.hloc))". As you can see, the Spacer's height is a number
> multiplied by the current heading location - self.hloc. However, if you
> at the attached generated PDF file, the headings quickly go out of
> with the text. I am guessing that this is because of my using '1' as the
> multiplier in NotalonPDF.appendHeading(). Is there any way that I can get
> the height of the font so that self.headings.append(Spacer(inch,
> * self.hloc)) would work with the proper font_height?
> Second, I need to get my application's title and author from another source
> in my application. However, with the current "myPageTemplate," I am unable
> to - I am forced to use a global variable in the same file. I wanted to
> the myPageTemplate get the title and the author from my NotalonPDF class's
> self.title and self.author fields, but I don't know how to do that.
> In summary, my questions are:
> 1. How can I fix the alignment issue in NotalonPDF.appendHeading()?
> 2. How can I get the document's title and author for myPageTemplate
> from the corresponding fields in NotalonPDF?
> Thank you for your assistance - it has helped me very much so far!
1) I don't see how you're going to do this unless you get accurate position
information from the things that are being laid out. The frame knows where stuff
is about to be positioned so theoretically you can have zero height widgets in
the story which record where they are laid out to provide information to the
other frame. Trying to do it with absolute calculation seems wrong.
2) Nothing prevents the mayPageTemplate callables being methods on an object.
More information about the reportlab-users