docbook-apps

  • 1.  Background image in header

    Posted 05-24-2007 10:08
    Dear list,

    I want to place a background image in the header of my pdf-file.

    I managed to put a image in the header and the text in front of it,
    but the image is clipped at the top. I first thought, that this is due
    to the region.before.extent-parameter not being big enough, but I set
    region.before.extent to 50mm which ist definitely a lot greater than
    the height of my background image, with no effect.
    I also tried to reduce the space for page.margin.top and increasing
    the space for body.margin.top, but this didn't work out either.
    I already set the padding for the header table cell to 0 everywhere.

    Any ideas what I'm doing wrong?

    Thats the header.content-template of my customization-layer:

    <xsl:template name="header.content">
    (...)
    <xsl:when test="$sequence='even' and $position='right'" >
    <xsl:attribute
    name="background-image">resources/header_even_innen.png</xsl:attribute>
    <xsl:attribute name="background-repeat">no-repeat</xsl:attribute>
    <xsl:attribute name="padding-before">0cm</xsl:attribute>
    <xsl:attribute name="padding-after">0cm</xsl:attribute>
    <xsl:attribute name="padding-start">0cm</xsl:attribute>
    <xsl:attribute name="padding-end">0cm</xsl:attribute>
    <xsl:attribute name="padding-top">0cm</xsl:attribute>
    <xsl:attribute name="padding-bottom">0cm</xsl:attribute>
    <xsl:attribute name="padding-left">0cm</xsl:attribute>
    <xsl:attribute name="padding-right">0cm</xsl:attribute>
    <xsl:attribute name="background-position-horizontal">right</xsl:attribute>
    <xsl:attribute name="background-position-vertical">bottom</xsl:attribute>
    <xsl:text>Text Text Text</xsl:text>
    </xsl:when>
    (...)
    </xsl:template>

    I'm using docbook-xsl 1.72.0, xsltproc and fop 0.93.

    Thank you a lot for your help in advance.

    Regards,
    Daniela



  • 2.  Re: [docbook-apps] Background image in header

    Posted 05-24-2007 14:20
    Hi,

    The problem is that you're putting the background image attribute in the
    header.content template, which is effectively applying it to a regular
    fo:block. Take a look at this fragment of code from the template
    header.table.


    <fo:table-cell text-align="left"
    display-align="before">
    ...
    <fo:block>
    <xsl:call-template name="header.content">
    <xsl:with-param name="pageclass" select="$pageclass"/>
    <xsl:with-param name="sequence" select="$sequence"/>
    <xsl:with-param name="position" select="'left'"/>
    <xsl:with-param name="gentext-key" select="$gentext-key"/>
    </xsl:call-template>
    </fo:block>
    </fo:table-cell>

    So, everything in header.content is called inside of an fo:block.
    Therefore, you're just producing:

    <fo:block background-image="image.png">

    and since the fo:block is only as tall as its content, it won't
    automatically be as tall as $region.before.extent.

    If you only want this background image to appear in the header of certain
    types of pages (odd or even, etc.), one solution is to make a custom page
    master (http://www.sagehill.net/docbookxsl/PageDesign.html) and apply the
    background-image attribute to the fo:region-before element. If you want it
    to apply to the header of all pages, you can also customize the
    header.tabletemplate and apply the background image to the fo:table
    element.

    I hope that's what you need.

    Colin

    On 5/24/07, Daniela Dänzer <daniela.daenzer@gmail.com> wrote:
    >
    > Dear list,
    >
    > I want to place a background image in the header of my pdf-file.
    >
    > I managed to put a image in the header and the text in front of it,
    > but the image is clipped at the top. I first thought, that this is due
    > to the region.before.extent-parameter not being big enough, but I set
    > region.before.extent to 50mm which ist definitely a lot greater than
    > the height of my background image, with no effect.
    > I also tried to reduce the space for page.margin.top and increasing
    > the space for body.margin.top, but this didn't work out either.
    > I already set the padding for the header table cell to 0 everywhere.
    >
    > Any ideas what I'm doing wrong?
    >
    > Thats the header.content-template of my customization-layer:
    >
    > <xsl:template name="header.content">
    > (...)
    > <xsl:when test="$sequence='even' and $position='right'" >
    > <xsl:attribute
    > name="background-image">resources/header_even_innen.png</xsl:attribute>
    > <xsl:attribute name="background-repeat">no-repeat</xsl:attribute>
    > <xsl:attribute name="padding-before">0cm</xsl:attribute>
    > <xsl:attribute name="padding-after">0cm</xsl:attribute>
    > <xsl:attribute name="padding-start">0cm</xsl:attribute>
    > <xsl:attribute name="padding-end">0cm</xsl:attribute>
    > <xsl:attribute name="padding-top">0cm</xsl:attribute>
    > <xsl:attribute name="padding-bottom">0cm</xsl:attribute>
    > <xsl:attribute name="padding-left">0cm</xsl:attribute>
    > <xsl:attribute name="padding-right">0cm</xsl:attribute>
    > <xsl:attribute
    > name="background-position-horizontal">right</xsl:attribute>
    > <xsl:attribute
    > name="background-position-vertical">bottom</xsl:attribute>
    > <xsl:text>Text Text Text</xsl:text>
    > </xsl:when>
    > (...)
    > </xsl:template>
    >
    > I'm using docbook-xsl 1.72.0, xsltproc and fop 0.93.
    >
    > Thank you a lot for your help in advance.
    >
    > Regards,
    > Daniela
    >
    > ---------------------------------------------------------------------
    > To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
    > For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
    >
    >



  • 3.  Re: [docbook-apps] Background image in header

    Posted 05-25-2007 08:10
    Hello Colin,

    thanks a lot for your help and explanation! I never would have figured
    out this on my own.
    I declared and use a custom page master now and that does exactly what
    it should.

    Regards,
    Daniela

    On 5/24/07, Colin Shapiro <cmshapiro@gmail.com> wrote:
    > Hi,
    >
    > The problem is that you're putting the background image attribute in the
    > header.content template, which is effectively applying it to a regular
    > fo:block. Take a look at this fragment of code from the template
    > header.table.
    >
    >
    > <fo:table-cell text-align="left"
    > display-align="before">
    > ...
    > <fo:block>
    > <xsl:call-template name="header.content">
    > <xsl:with-param name="pageclass" select="$pageclass"/>
    > <xsl:with-param name="sequence" select="$sequence"/>
    > <xsl:with-param name="position" select="'left'"/>
    > <xsl:with-param name="gentext-key" select="$gentext-key"/>
    > </xsl:call-template>
    > </fo:block>
    > </fo:table-cell>
    >
    > So, everything in header.content is called inside of an fo:block.
    > Therefore, you're just producing:
    >
    > <fo:block background-image="image.png">
    >
    > and since the fo:block is only as tall as its content, it won't
    > automatically be as tall as $region.before.extent.
    >
    > If you only want this background image to appear in the header of certain
    > types of pages (odd or even, etc.), one solution is to make a custom page
    > master (
    > http://www.sagehill.net/docbookxsl/PageDesign.html) and
    > apply the background-image attribute to the fo:region-before element. If
    > you want it to apply to the header of all pages, you can also customize the
    > header.table template and apply the background image to the fo:table
    > element.
    >
    > I hope that's what you need.
    >
    > Colin
    >
    >
    > On 5/24/07, Daniela Dänzer <daniela.daenzer@gmail.com> wrote:
    > >
    > > Dear list,
    > >
    > > I want to place a background image in the header of my pdf-file.
    > >
    > > I managed to put a image in the header and the text in front of it,
    > > but the image is clipped at the top. I first thought, that this is due
    > > to the region.before.extent-parameter not being big enough, but I set
    > > region.before.extent to 50mm which ist definitely a lot greater than
    > > the height of my background image, with no effect.
    > > I also tried to reduce the space for page.margin.top and increasing
    > > the space for body.margin.top, but this didn't work out either.
    > > I already set the padding for the header table cell to 0 everywhere.
    > >
    > > Any ideas what I'm doing wrong?
    > >
    > > Thats the header.content-template of my customization-layer:
    > >
    > > <xsl:template name="header.content">
    > > (...)
    > > <xsl:when test="$sequence='even' and $position='right'" >
    > > <xsl:attribute
    > >
    > name="background-image">resources/header_even_innen.png</xsl:attribute>
    > > <xsl:attribute
    > name="background-repeat">no-repeat</xsl:attribute>
    > > <xsl:attribute
    > name="padding-before">0cm</xsl:attribute>
    > > <xsl:attribute name="padding-after">0cm</xsl:attribute>
    > > <xsl:attribute name="padding-start">0cm</xsl:attribute>
    > > <xsl:attribute name="padding-end">0cm</xsl:attribute>
    > > <xsl:attribute name="padding-top">0cm</xsl:attribute>
    > > <xsl:attribute
    > name="padding-bottom">0cm</xsl:attribute>
    > > <xsl:attribute name="padding-left">0cm</xsl:attribute>
    > > <xsl:attribute name="padding-right">0cm</xsl:attribute>
    > > <xsl:attribute
    > name="background-position-horizontal">right</xsl:attribute>
    > > <xsl:attribute
    > name="background-position-vertical">bottom</xsl:attribute>
    > > <xsl:text>Text Text Text</xsl:text>
    > > </xsl:when>
    > > (...)
    > > </xsl:template>
    > >
    > > I'm using docbook-xsl 1.72.0, xsltproc and fop 0.93.
    > >
    > > Thank you a lot for your help in advance.
    > >
    > > Regards,
    > > Daniela
    > >
    > >
    > ---------------------------------------------------------------------
    > > To unsubscribe, e-mail:
    > docbook-apps-unsubscribe@lists.oasis-open.org
    > > For additional commands, e-mail:
    > docbook-apps-help@lists.oasis-open.org
    > >
    > >
    >
    >