You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by jw2k1888 Wright2k1 <jw...@hotmail.com> on 2002/09/28 16:32:05 UTC

svg image is to large and hence truncated when converted to pdf


Hi all,

I am currently using xsl/svg to transform an xml file into svg report 
graphs.  The result is an svg image(file) that has 1 or more graphs stacked 
above one another depending upon the data in the xml file. Like a vertical 
list of graphs.  I would like to export this xsl/svg output (svg graphs) to 
pdf format but when I attempted this the pdf file comes out with only 1 page 
which is the very top of the svg image?

Is there anyway of using xsl:fo so that if the svg image's height is like 
2000 pixels high the pdf conversion would recognise that the first 600pixels 
would be page 1 and the next 600pixels would be page 2 and so on?

simple analogy:

XML file:

<root>
</root>

XSL/SVG file:

<xsl:template name="2pageExample">
   <xsl:param name="counter" select="0"/>
   <xsl:param name="max" select="100"/>

   <svg:text x="50" style="fill:rgb(0,0,0)">
      <xsl:attribute name="y">
         <xsl:value-of select="$counter*20 + 50"/>
      </xsl:attribute>
      Blah
   </svg:text>

   <xsl:if test="$counter != $max">
     <xsl:call-template name="2pageExample">
       <xsl:with-param name="counter" select="$counter + 1"/>
       <xsl:with-param name="max" select="$max"/>
     </xsl:call-template>
   </xsl:if>
</xsl:template>

This would print out "Blah" text 101 times, creating a list of Blah text 
that spans over an equivalent of 2 pdf pages.

Now when I apply

   <fo:block>
      <fo:instream-foreign-object>
           <svg:svg width="550" height="660">
                <xsl:call-template name="2pageExample"/>
            </svg:svg>
      </fo:instream-foreign-object>
   </fo:block>

I get one pdf page with the an incomplete list of blah text...

I've tried <fo:external-graphics> which produces a two page pdf file but 
page 1 is blank and the list of Blah text starts on page 2 and then gets 
truncated.

I've tried placing it in <fo:tables> but it only works with normal text and 
not svg generated text file.

Any sort of assistance or sugguestions would be greatly appreciated, Thanks.

Regards,

Jason.


_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


Re: svg image is to large and hence truncated when converted to pdf

Posted by "J.Pietschmann" <j3...@yahoo.de>.
jw2k1888 Wright2k1 wrote:
> Is there anyway of using xsl:fo so that if the svg image's height is 
> like 2000 pixels high the pdf conversion would recognise that the first 
> 600pixels would be page 1 and the next 600pixels would be page 2 and so on?

No. You'll have to split it into several SVG objects explicitely,
like

<xsl:template name="2pageExample">
   <xsl:param name="counter" select="0"/>
   <xsl:param name="max" select="100"/>
   <fo:instream-foreign-object>
     <svg:svg width="550" height="660">
       <svg:text x="50" style="fill:rgb(0,0,0)" y=0>
         <xsl:text>Blah</xsl:text>
       </svg:text>
...

BTW
>           <svg:svg width="550" height="660">

Using pixel units is unwise. Use cm/mm/in/pt instead.
And
>      </xsl:attribute>
>      Blah
>   </svg:text>

This will surrout "Blah" with probably unwanted whitespaces.
Use
  <xsl:text>Blah</xsl:text>
instead.

J.Pietschmann