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 David Breare <da...@canonburymanagement.co.uk> on 2009/04/29 12:21:34 UTC

Generate a PCL file

Hi,

 

I have used IKVM to generate .Net DLLs for Apache FOP 0.95 and the
associated .jar files. Embedded the DLLs into my code and have
successfully managed to generate a PDF file. I then changed the code to
generate a PCL file which I am required to provide to a third party but
I get a "Method not implemented" exception on the transformer.transform
line. I'm sure I have missed something but I cannot find any full code
samples which show PCL file generation. If anyone can provide any help
it would be appreciated as I'm tearing my hair out.

 

            AppDomain.CurrentDomain.Load("xercesImpl-2.7.1");

            AppDomain.CurrentDomain.Load("batik-all-1.6");

 

            java.lang.System.setProperty(

                "javax.xml.parsers.SAXParserFactory",

                "org.apache.xerces.jaxp.SAXParserFactoryImpl");

 

 

java.io.BufferedOutputStream fs = new java.io.BufferedOutputStream(new
java.io.FileOutputStream(new
java.io.File(HttpContext.Current.Server.MapPath("normal.pcl"))));

 

            FopFactory fopFactory = FopFactory.newInstance();

 

 

            org.apache.fop.apps.Fop fop =
fopFactory.newFop(MimeConstants.__Fields.MIME_PCL, fs);

 

 

                FormattingResults results = fop.getResults();

                TransformerFactory factory =
TransformerFactory.newInstance();

                Transformer transformer = factory.newTransformer(); //
identity transformer

                       

              // Step 5: Setup input and output for XSLT transformation 

              // Setup input stream

              Source src = new StreamSource(new
java.io.File(HttpContext.Current.Server.MapPath("normal.fo")));

 

              // Resulting SAX events (the generated FO) must be piped
through to FOP

              Result res = new
javax.xml.transform.sax.SAXResult(fop.getDefaultHandler());

                        

              // Step 6: Start XSLT transformation and FOP processing

              transformer.transform(src, res);

              

              fs.close();