Placing an image in the footer

HelenM
Posts: 11
Joined: Mon Mar 25, 2013 9:52 pm

Placing an image in the footer

Post by HelenM »

Hello

Another newbie question! I am creating pdf from DocBook and although I have read the Sage Hill chapter on footers, it is still not clear to me how to insert an image in the footer. Can I do this by only editing the customisation layer? Or do I have to edit the footer.content template as well?

Thanks in advance for any pointers.

Best wishes
Helen
Quintus
Posts: 2
Joined: Tue Jan 26, 2010 12:14 pm

Re: Placing an image in the footer

Post by Quintus »

Hi Helen,
no, you do not have to customize the footer content in a separate stylesheet, but to keep things neat and tidy it is advisable.
If you don't want to do it, though, you have to add the footer.content template to your customization layer and change it, e.g. like that:

Code: Select all

<xsl:template name="footer.content">
<!-- Prints the referenced Picture in the center of the footer content -->
<xsl:choose>
<xsl:when test="$pageclass = 'body' and $position = 'center'">
<fo:external-graphic width="auto" padding-top="0.5em" height="auto"
content-width="{$footer.graphic.width}"src="images/Logo.png"/>
</xsl:when>
</xsl:choose>
</xsl:template>
Please note that you have to consider what pageclass you want to have the picture on, in this case body, but there is also frontmatter, like titlepage, lot etc. and backmatter, like appendices, index; it is stated in the template, so you have to define the parameter for this within the stylesheet:

Code: Select all

<xsl:param name="pageclass" select="''"/>
Also, the position has to be stated where needed, the parameter has to be defined for that also:

Code: Select all

<xsl:param name="position" select="''"/>
Also it can be important to format the layout table for the footer, probably the generated text, but these are details.
More important is probably to define the width for your picture

<xsl:variable name="footer.graphic.width">
<xsl:text>150pt</xsl:text>
</xsl:variable>

since otherwise it will get stretched or compressed.

This at least is the way I do it, hopefully it could help you a bit.

cheers,
Quintus
HelenM
Posts: 11
Joined: Mon Mar 25, 2013 9:52 pm

Re: Placing an image in the footer

Post by HelenM »

Thank you very much Quintus for this detailled reply. Looks very helpful. I will try this out this afternoon.
Best wishes,
Helen
HelenM
Posts: 11
Joined: Mon Mar 25, 2013 9:52 pm

Re: Placing an image in the footer

Post by HelenM »

Hi again Quintus.

I got this working according to your instructions - thank you so much! Just one surprising result - The logo appears 3 times in the footer. It seems to me that maybe the footer has 3 columns and it is putting the logo in the centre of each column. Could this be the case?

Thanks in advance.

Best wishes,
Helen
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Placing an image in the footer

Post by sorin_ristache »

Hi Helen,

Can you show your complete customization / custom XSLT template? From your description it's hard to tell why the logo shows up 3 times in the footer. Did you try to create a table in your custom XSLT code? I looked in the "footer.content" named template in the built-in stylesheet xsl/fo/pagesetup.xsl and it does not create a table.


Regards,
Sorin
HelenM
Posts: 11
Joined: Mon Mar 25, 2013 9:52 pm

Re: Placing an image in the footer

Post by HelenM »

Hi Sorin
Sorry not to have replied, I have been away. A friend helped me fix this. I will find out how he did it and post in case it can help anyone else.
Best wishes
Helen
Post Reply