it's not a java code
I just execute fop script from fop-0.93 distribution


On 6/27/07, ramkumar.m.v <[EMAIL PROTECTED]> wrote:

You are getting the error possibly because you are not
setting the renderer in your java code.

     //Setup Renderer (output format)
      fopDriver.setRenderer(Driver.RENDER_PDF);

Full code given below:


      //Setup input
       File xsltfile = new File("xslFileWithPath);

       //Construct FOP driver
        Driver fopDriver = new Driver();

       //Setup logger
      Logger logger = new
ConsoleLogger(ConsoleLogger.LEVEL_ERROR);
            fopDriver.setLogger(logger);
            MessageHandler.setScreenLogger(logger);

            //Setup Renderer (output format)
            fopDriver.setRenderer(Driver.RENDER_PDF);

            //Setup a buffer to obtain the content
length
            ByteArrayOutputStream out = new
ByteArrayOutputStream();
            fopDriver.setOutputStream(out);

            try
            {
                fopDriver.setOutputStream(out);

                //Setup XSLT
                TransformerFactory factory =
TransformerFactory.newInstance();
                Transformer transformer =
                    factory.newTransformer(new
StreamSource(xsltfile));

//              Setup input for XSLT transformation
                Source src = new SAXSource(new
XmlReader(),new InputSource(issues));

                //Resulting SAX events (the generated
FO) must be piped through to FOP
                Result res = new
SAXResult(fopDriver.getContentHandler());

                //Start XSLT transformation and FOP
processing
                transformer.transform(src, res);
            }
            catch (Exception e)
            {
                e.printStackTrace();
            }
            finally
            {
                printOutput = new PrintOutput();
                printOutput.setSource("some thing");

printOutput.setProduceTime(System.currentTimeMillis());
                printOutput.setOutput(out);

                out.close();
            }

Hope this helps.More examples are in the fop examples
directory.

Regards
Ram
--- Ady Wicaksono <[EMAIL PROTECTED]> wrote:

> HI
>
> I'm newbie with Apache FOP
>
> I try to test it using this XML
> -------- cut here ---------------
> <?xml version="1.0" ?>
> <persons>
>   <person username="JS1">
>     <name>John</name>
>     <family_name>Smith</family_name>
>   </person>
>   <person username="ND1">
>     <name>Nancy</name>
>     <family_name>Davolio</family_name>
>   </person>
> </persons>
> -------- cut here ---------------
>
> This XLS
> -------- cut here ---------------
> <?xml version="1.0" ?>
> <xsl:stylesheet
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
> version="
> 1.0">
> <xsl:output method="xml" indent="yes"/>
>
> <xsl:template match="/">
>        <root> <xsl:apply-templates/> </root>
> </xsl:template>
>
> <xsl:template match="//person">
>         <name username="[EMAIL PROTECTED]">
>            <xsl:value-of select="name" />
>         </name>
> </xsl:template>
>
> </xsl:stylesheet>
> -------- cut here ---------------
>
> Using Fedora Linux 5, Java SDK 1.5
>
>  sh fop -xml a.xml -xls a.xls -pdf a.pdf
> GOT:
>
> Jun 26, 2007 3:47:50 PM org.apache.fop.cli.Main
> startFOP
> SEVERE: Exception
> org.apache.fop.apps.FOPException: Renderer has not
> been set!
>         at
>
org.apache.fop.cli.CommandLineOptions.getOutputFormat(
> CommandLineOptions.java:796)
>         at
> org.apache.fop.cli.Main.startFOP(Main.java:151)
>         at
> org.apache.fop.cli.Main.main(Main.java:191)
>
> Any information on this error?
>
>
> --
> Regards,
>
> Ady Wicaksono
> Email:
> ady.wicaksono at gmail.com
>


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




--
Regards,

Ady Wicaksono
Email:
ady.wicaksono at gmail.com

Reply via email to