Hi, 
I'm using fop-0.95 to generate a PDF file from an xml template, I have a
problem regarding the external-graphic renderer. I never had the correct
size in the pdf for gif or png images even if I can modifiy the size by
changing the external-graphic attributes. Could you help me to resolve this
issue. 
thanks in advance

The xml
<!-- The same image (size gived by Gimp) -->
img src="images/topic.png" content-width="136mm" content-height="88mm" />
img src="images/topic.gif" content-width="13mm" content-height="8mm" />
img src="images/topic.gif" content-width="13.652cm" content-height="8.855cm"
/>
img src="images/topic.gif" content-width="13cm" content-height="8cm" />
img src="images/topic.gif" content-width="387px" content-height="251px" />
img src="images/topic.gif" content-width="5.375in" content-height="3.486in"
/>
img src="images/topic.gif" content-width="5in" content-height="3in" />

The xsl
<xsl:template name="displayImage">
        <xsl:param name="contentWidthFound" select="''"/>       
        <xsl:param name="contentHeightFound" select="''"/>      
        <xsl:param name="widthFound" select="''"/>      
        <xsl:param name="heightFound" select="''"/>     
        <xsl:param name="scaleFound" select="1"/>       
        <xsl:param name="srcFound" select="''"/>        
        <xsl:variable name="src" select="concat($resourcesPath,$srcFound)" />

        <fo:block space-before="2mm" space-after="2mm">
                <xsl:variable name="scale">
                        <xsl:if test="$scaleFound">
                                <xsl:value-of select="$scaleFound"/>
                        </xsl:if>
                        <xsl:if test="not($scaleFound)">
                                <xsl:value-of select="1"/>
                        </xsl:if>
                </xsl:variable>
                <xsl:variable name="pixelWidth" select="$widthFound"/>
                <xsl:variable name="width">
                        <xsl:if test="$contentWidthFound!=''">
                                <xsl:value-of select="$contentWidthFound"/>
                        </xsl:if>
                        <xsl:if test="$contentWidthFound=''">
                                <xsl:value-of select="floor(($pixelWidth * 
$scale) div $dpi)"/>
                                <xsl:text>in</xsl:text>
                        </xsl:if>
                </xsl:variable>
                <xsl:variable name="pixelHeight" select="$heightFound"/>
                <xsl:variable name="height">
                        <xsl:if test="$contentHeightFound!=''">
                                <xsl:value-of select="$contentHeightFound"/>
                        </xsl:if>
                        <xsl:if test="$contentHeightFound=''">
                                <xsl:value-of select="floor(($pixelHeight * 
$scale) div $dpi)"/>
                                <xsl:text>in</xsl:text>
                        </xsl:if>
                </xsl:variable>
                <fo:external-graphic width="{$width}" height="{$height}"
content-width="scale-to-fit" content-height="scale-to-fit"
src="url('{$src}')"/>
        </fo:block>
</xsl:template>

-- 
View this message in context: 
http://www.nabble.com/external-graphic-size-tp20811210p20811210.html
Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to