Hobbes
Hobbes

Reputation: 2125

External-graphic has space above even though I've set it to zero

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:

enter image description here

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:

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

Answers (1)

lfurini
lfurini

Reputation: 3788

I think the gap has two culprits:

  • the three borders (on fo:block-container, fo:block and fo:external-graphic), which erode the available heigth
  • the half-leading trait

Removing 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

Related Questions