Background image in header

View: New views
3 Messages — Rating Filter:   Alert me  

Background image in header

by Daniela Dänzer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...
For additional commands, e-mail: docbook-apps-help@...


Re: Background image in header

by Colin Shapiro-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...> 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@...
For additional commands, e-mail: docbook-apps-help@...



Re: Background image in header

by Daniela Dänzer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...> 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@...> 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@...
> > For additional commands, e-mail:
> docbook-apps-help@...
> >
> >
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@...
For additional commands, e-mail: docbook-apps-help@...