Hi,

extra spaces before and after the image are half leading (above and below text). They are due to font-size and line-height properties.

If your fo:block doesn't contain any text, you can set them to 0.

Since the line-height property is defaulting to 1.2 (IOW, computed value is 1.2 * font-size), you only need to explicitly set the font-size to 0 (for the fo:block)

Le 29/05/2012 14:39, Léa Massiot a écrit :

Hello and thank you for reading my post.

When I put a "fo:external-graphic" inside a "fo:block" (cf. the XSL-FO
stylesheet and an image of an excerpt of the resulting PDF document attached
below), I get:
- an extra (red) margin above the image,
- an extra (red) margin below the image (bigger than the previous),
- no extra left or right margins.

What are these margins?
Can they be removed?

Nota:
In the PDF file attached, the image is a GIF image.
The background of the "fo:external-graphic" element is green (rgb(0,255,0)).
The background of the "fo:block" element is red (rgb(255,0,0)).

Thank you and best regards.


XSF-FO stylesheet

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                               xmlns:fo="http://www.w3.org/1999/XSL/Format";>

   <xsl:template match="quotation">

     <fo:root>

       <fo:layout-master-set>
         <fo:simple-page-master master-name = "A4-portrait"
                                page-height="{@page_height}"
                                page-width="{@page_width}"
                                margin="{@margin}"
                                >

           <fo:region-body background-color="orange" />

         </fo:simple-page-master>
       </fo:layout-master-set>

       <fo:page-sequence master-reference="A4-portrait">
         <fo:flow flow-name="xsl-region-body">
           <xsl:apply-templates select="area" />
         </fo:flow>
       </fo:page-sequence>
     </fo:root>

   </xsl:template>

   <xsl:template match="area">

       <fo:block background-color="rgb(255, 0, 0)">
        <fo:external-graphic content-height="120%"
                             scaling="uniform"
                             background-color="rgb(0, 255, 0)"
                             src="url(images/try_36px_36px.gif)" />

         <fo:external-graphic content-height="120%"
                             scaling="uniform"
                             background-color="rgb(0, 255, 0)"
                             src="url(images/try_36px_36px.gif)" />
       </fo:block>

   </xsl:template>
</xsl:stylesheet>
http://old.nabble.com/file/p33924830/test_fo_external_graphic.pdf
test_fo_external_graphic.pdf


http://old.nabble.com/file/p33924830/excerpt_of_pdf_doc.png
http://old.nabble.com/file/p33924830/test_fo_external_graphic.pdf
test_fo_external_graphic.pdf


--
Pascal

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org

Reply via email to