Page 1 of 1

Placing an image in the footer

Posted: Thu Jun 13, 2013 12:02 pm
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

Re: Placing an image in the footer

Posted: Thu Jun 13, 2013 2:28 pm
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

Re: Placing an image in the footer

Posted: Thu Jun 13, 2013 2:46 pm
by HelenM
Thank you very much Quintus for this detailled reply. Looks very helpful. I will try this out this afternoon.
Best wishes,
Helen

Re: Placing an image in the footer

Posted: Mon Jun 24, 2013 12:36 pm
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

Re: Placing an image in the footer

Posted: Mon Jul 01, 2013 12:49 pm
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

Re: Placing an image in the footer

Posted: Wed Jul 24, 2013 5:56 pm
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