I need to display a large background image on the cover page. That image needs:
- To be shrunk to the width of
region-body
. - To be positioned exactly at the bottom of
region-body
.
Using background-image
is not an option since the image needs to be scaled. So I print the image in a long region-before
that extends below the region-body
. It works.
Then I try to position the image at the bottom of region-before
using absolute-position="absolute"
and bottom="0cm"
. Unfortunately, bottom
does not work the way I expected. (The image stays to the top.)
<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="section1-cover" page-height="11in" page-width="8.5in"
margin-top="1cm" margin-bottom="0">
<fo:region-before region-name="xsl-region-before" extent="11in - 1cm - .75in"
background-color="beige"/>
<fo:region-body margin-top="1cm" margin-bottom=".75in" margin-right=".395in"
margin-left=".395in"/>
<fo:region-after region-name="xsl-region-after" extent=".75in" background-color="orange"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="section1-cover">
<fo:static-content flow-name="xsl-region-before">
<fo:block-container margin-right=".395in" margin-left=".395in"
absolute-position="absolute" bottom="0cm">
<!-- I expected that block-container to go down to the bottom -->
<fo:block line-height=".5">
<!-- line-height="1" seems more logical but yields unwanted extra space -->
<fo:external-graphic src="url('cover-background.jpg')" width="100%"
content-width="scale-down-to-fit"/></fo:block>
</fo:block-container>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<fo:block font-size="28pt">Title</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
Does anyone have a solution?
Note: I don’t want to position that image from the top, since I cannot reliably compute the image height after scaling.
Note: It has to work in FOP.