Cristi,

Take a look at following articles.

http://blog.trivadis.com/blogs/andreasmengel/archive/2008/03/14/generating-svg-pie-charts-in-pdf-documents.aspx
http://www.svgopen.org/2003/papers/CreatingSVGPieChartsThroughWebService/index.html

You'll need to use <xsl:attribute> along with <svg:svg> and
<fo:instream-foreign-object>


Regards,
Jayant










|------------>
| From:      |
|------------>
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
  |Cristi Cioriia <[email protected]>                            
                                                                     |
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| To:        |
|------------>
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
  |<[email protected]>                                           
                                                                     |
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Date:      |
|------------>
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
  |01/17/2011 10:57 AM                                                          
                                                                     |
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Subject:   |
|------------>
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
  |Re: Embedding SVG dynamically into fo file                                   
                                                                     |
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|





Thanks for such a quick reply.

Using your feedback I was able to advance a little: if I replace  "Some
text " from your sample with <xsl:value-of select="svg"/> I can see in
my report the svg that is generated. What I need though is that this
code is executed so that in the PDF report I have the actual image, not
its SVG representation. Any hint on how can I achieve that?

Regards,
Cristi
> Cristi,
>
> In order to include SVG in your XSLT file, first declare the name space
as
> follows:
>
> <xsl:stylesheet version="1.0"
>                    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>        xmlns:fo="http://www.w3.org/1999/XSL/Format";
>        xmlns:svg="http://www.w3.org/2000/svg";>
>
>
> Then you can generate SVG as shown below:
>
>                    <fo:block>
>                                      <fo:instream-foreign-object
span="all"
> content-width="500pt" content-height="700pt" border-style="solid"
> border-width="1" start-indent="0" margin-left="0">
>                                            <svg
> xmlns="http://www.w3.org/2000/svg"; height="500" width="700">
>                                            <rect x="50" y="50"
height="400"
> width="630" fill="none" stroke="black" stroke-width="1" />
>                                            <text x="200" y="75"
> style="font-family: ariel; fill:black; font-size:14;
> font-weight:bold;">Some text</text>
>                                            </svg>
>                                      </fo:instream-foreign-object>
>                                </fo:block>
>
>
> Regards,
> Jayant
>
>
>
> |------------>
> | From:      |
> |------------>
>
>--------------------------------------------------------------------------------------------------------------------------------------------------|

>    |Cristi Cioriia<[email protected]>
|
>
>--------------------------------------------------------------------------------------------------------------------------------------------------|

> |------------>
> | To:        |
> |------------>
>
>--------------------------------------------------------------------------------------------------------------------------------------------------|

>    |<[email protected]>
|
>
>--------------------------------------------------------------------------------------------------------------------------------------------------|

> |------------>
> | Date:      |
> |------------>
>
>--------------------------------------------------------------------------------------------------------------------------------------------------|

>    |01/17/2011 10:10 AM
|
>
>--------------------------------------------------------------------------------------------------------------------------------------------------|

> |------------>
> | Subject:   |
> |------------>
>
>--------------------------------------------------------------------------------------------------------------------------------------------------|

>    |Embedding SVG dynamically into fo file
|
>
>--------------------------------------------------------------------------------------------------------------------------------------------------|

>
>
>
>
>
> Hi guys,
>
> I have ran into a dead end trying to generate a PDF report which should
> contain SVG files generated on the fly, and I was hoping that I can find
> some help here on how to proceed next.
> At first, I embedded a svg file into a fo file using the
> fo:instream-foreign-object and everything worked as expected, generating
> the PDF report that I needed from the fo file by following the examples
> from the FO website.
> But then the pdf report that I have to generate uses as source data a
> java object which contains a string property which provides the svg file
> and looking at the example from the FOP website
>
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/examples/embedding/java/embedding/ExampleObj2PDF.java

>
> I created an xslt file like this:
>
> <xsl:template match="reportEntry">
> <fo:block>
>
> <fo:block>
> <xsl:value-of select="title"/>
> </fo:block>
>
> <fo:block>
> <xsl:value-of select="description"/>
> </fo:block>
>
> <fo:instream-foreign-object>
> <xsl:value-of select="svg"/>
> </fo:instream-foreign-object>
>
> </fo:block>
> </xsl:template>
>
> But now, when I run the code I get the following exception:
>
> javax.xml.transform.TransformerException:
> org.apache.fop.fo.ValidationException: Error(Unknown location):
> fo:instream-foreign-object is missing child elements.
> Required Content Model: one (1) non-XSL namespace child
>
> I have tried to find any help with google on how I can approach this,
> but the only resources that I found use static resources as I did in the
> first scenario, which is not enough for my use case. Can you point me
> into the right direction on how to approach this?
>
> Thanks for your help,
> Cristi
>
> --
> Cristian-Andrei Cioriia
> Programator Java
>
> 1&1 Internet Development S.R.L. - Bucharest/Romania - Web Applications
> Hosting Romania
> 18 Mircea Eliade St
> Sect 1, Bucharest
> RO Bucharest, 012015
> Num&#259;r de telefon: +40 751 812 984
> [email protected]
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>


--
Cristian-Andrei Cioriia
Programator Java

1&1 Internet Development S.R.L. - Bucharest/Romania - Web Applications
Hosting Romania
18 Mircea Eliade St
Sect 1, Bucharest
RO Bucharest, 012015
Num&#259;r de telefon: +40 751 812 984
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]







---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to