[reportlab-users] Line heights and PageTemplates
Robin Becker
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.
>
........
> test.construct()
>
> Now, there are two parts that I need to fix in there. First of all, the
> line
> 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
> look
> at the attached generated PDF file, the headings quickly go out of
> alignment
> 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,
> font_height
> * 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
> make
> 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.
--
Robin Becker
More information about the reportlab-users
mailing list