[xsl] Re: [FO] Background image on whole page

Subject: [xsl] Re: [FO] Background image on whole page
From: Vincent Hennebert <vincent.hennebert@xxxxxxxxxxxxxxxx>
Date: Thu, 10 Jan 2008 11:34:01 +0000
>> Each region can have its own background, so you can use 
>> background-image= on <region-body>.
>>
>> To get "the whole page" you will need to have the body region extend 
>> to the page dimensions, which is not really desirable for top and 
>> bottom margins.  
>
> Yes, I noticed.
>
>> An alternative is to parcel out a whole page background into bits 
>> that are set as the backgrounds of the respective perimeter regions 
>> and body region.
>
> <sigh> I was hoping you wouldn't say that. Oh well. I guess I will chalk 
> that up as something else XSLFO can't do.

Well you can also use an absolutely positioned block-container with 
a background-image; for example:
    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format";>
      <fo:layout-master-set>
        <fo:simple-page-master master-name="page"
          page-height="29.7cm" page-width="21cm"
          margin-top="2cm" margin-bottom="2cm"
          margin-left="3cm" margin-right="3cm">
          <fo:region-body/>
        </fo:simple-page-master>
      </fo:layout-master-set>
      <fo:page-sequence master-reference="page">
        <fo:flow flow-name="xsl-region-body">
          <fo:block-container absolute-position="absolute"
            top="-2cm" left="-3cm" width="21cm" height="29.7cm"
            background-image="path/to/the/image.png">
            <fo:block/>
          </fo:block-container>
          <fo:block>
            The document starts here...
            ...
          </fo:block>
        </fo:flow>
      </fo:page-sequence>
    </fo:root>

HTH,
Vincent


--
Vincent Hennebert                            Anyware Technologies
http://people.apache.org/~vhennebert         http://www.anyware-tech.com
Apache FOP Committer                         FOP Development/Consulting

Current Thread