Hi,

I ran into nearly the same problem some time ago.
I had a svg with arbitrary height and width and I wanted to fit the image to a
single page (A4).
But my image is directly embedded in fo code, that is given to FOP for pdf
output.
<fo:instream-foreign-object>
 <svg:svg> .... </svg:svg>
</fo:instream-foreign-object>

And like you, I just got a clip of the whole image.
My solution to fit this image to a single page was to find out,
how many px fit in one page and then scale my image to this size.
Actually all fo code is produced with xslt:

<xsl:variable name="max_width" select="510"/>
<xsl:variable name="max_height" select="680"/>

<!-- Scaling Factor -->
<xsl:variable name="scale">
<xsl:choose>
<xsl:when test="$max_height &lt; $height or $max_width &lt; $width">
 <xsl:choose>
 <xsl:when test="$max_height div $height &lt; $max_width div $width">
  <xsl:value-of select="$max_height div $height"/>
 </xsl:when>
 <xsl:otherwise>
  <xsl:value-of select="$max_width div $width"/>
 </xsl:otherwise>
 </xsl:choose>
</xsl:when>
<xsl:otherwise>
 <xsl:value-of select="1"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>

$height and $width are the effective dimensions of the image.
then just put everything in svg:g :
<svg:g id="printarea" transform="{concat('scale(',$scale,')')}">
...
</svg:g>
and your svg will fit everytime..

Hope that helps, Peter

--
[EMAIL PROTECTED]
Institut f�r Medizinische Informatik, Statistik und Epidemiologie (IMISE)
Universit�t Leipzig

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

Reply via email to