Search code examples
layoutxsl-fo

Unwanted margin after fo:external-graphic


A margin of 1 mm appears after an image. My XML:

<fo:block-container position="absolute" width="47.6mm" height="160mm" font-family="Verdana">
    <fo:block-container position="absolute" height="25mm" space-after="3mm">
        <fo:block>
            <fo:external-graphic src="release heading.svg" />
        </fo:block>
        <fo:block font-size="7pt" text-align="start" color="#6f696d" display-align="center" start-indent="0mm" background-color="#efefef">
             <fo:table border-collapse="collapse">
                  ...  
             </fo:table>
        </fo:block>
    </fo:block-container>

It looks like this:

enter image description here

I do not want the white line.

I tried to set content-height="100%", to no avail:

<fo:external-graphic content-height="100%" src="release heading.svg" />

If I draw margins around the image and the block, it is clear that the margin is between the two:

<fo:block border-style="solid" border-width="thin" border-color="black">
    <fo:external-graphic content-height="100%" src="release heading.svg" border-style="solid" border-width="thin" border-color="black"/>
</fo:block>

enter image description here

But how do I get rid of it?


Solution

  • I just found the answer on a FOP forum.

    The line-height property is not specified, but calculated to 1.2 * font-size. So the block is higher than the image.

    If I set font-size to 0 on the block:

    <fo:block font-size="0pt">
        <fo:external-graphic content-height="100%" src="release heading.svg"/>
    </fo:block>
    

    ... the line disappears.