Reputation: 2125
My XSL-FO template has an image in the footer of each page:
<fo:block-container left="0mm" top="10mm" absolute-position="absolute" width="210mm" height="10mm" border="0.1pt black solid" margin="0mm" padding="0mm" space-before="0mm">
<fo:block border="0.1pt green solid" margin="0mm" padding="0mm" space-before="0mm">
<fo:external-graphic src="grayblock.pdf" height="10mm" content-height="scale-to-fit" border="0.1pt blue solid" margin="0mm" padding="0mm" space-before="0mm"/>
</fo:block>
</fo:block-container>
I expect the top of the image to be aligned with the top of the block-container. But this is the result I get:
My image (the blue/gray rectangle) starts about 0.5 mm below the top of the block-container (the distance between the black line and the blue/gray rectangle).
What I've tried:
margin="0mm" padding="0mm" space-before="0mm"
to make sure the block-container, block and external-graphic don't inherit any margins, padding etc. from ancestors. That didn't change the result.Normally, this 0.5 mm gap doesn't matter much. In this case, I'm trying to align two block-containers and their contents, and the difference is making it difficult to get them to line up exactly.
How do I eliminate this gap above the external-graphic?
(I'm using Antenna House XSL Formatter 6.1)
Upvotes: 4
Views: 1510
Reputation: 3788
I think the gap has two culprits:
fo:block-container
, fo:block
and fo:external-graphic
), which erode the available heigthRemoving the borders and setting the block line-height
to be exactly 10mm should avoid the gap (I tested with FOP 2.2):
<fo:block-container left="0mm" top="30mm" absolute-position="absolute" width="210mm" height="10mm" margin="0mm" padding="0mm" space-before="0mm" background-color="#AAFFFF">
<fo:block line-height="10mm" line-stacking-strategy="font-height" margin="0mm" padding="0mm" space-before="0mm" background-color="#FFFFAA">
<fo:external-graphic vertical-align="top" src="grayblock.pdf" height="10mm" content-height="scale-to-fit" margin="0mm" padding="0mm" space-before="0mm"/>
</fo:block>
</fo:block-container>
Upvotes: 4