public Object CreatePDF(String xmlFilename,
                          String xslFullName,
                          String pdfFilename,
                          IXalanExtensionService xalanExtensionClass)
  {
    Registry registry = Registry.getRegistry( this );

    FileOutputStream fileOutputStream = null;
    this.xalanExtensionClass = xalanExtensionClass;

        OutputStream bufferedOutputStream = null;

    FopFactory fopFactory = null;
    FOUserAgent foUserAgent = null;

    try
    {
            fopFactory = FopFactory.newInstance( new File( getConfigFileURI( xslFullName ) ).toURI() );

            foUserAgent = fopFactory.newFOUserAgent();
            bufferedOutputStream = new FileOutputStream( pdfFilename );
            bufferedOutputStream = new BufferedOutputStream( bufferedOutputStream );
    }
    catch( Exception ex )
    {
        CMEReportPADPDFTranslate.logger.error( "Exception in CreatePDF() -> setOutputStream(): " + ex );
    }

    //Setup XML input
    Source src = new StreamSource(xmlFilename);
    Source xsltSrc = new StreamSource(xslFullName);

    try {
        // Construct fop with desired output format
        Fop fop = fopFactory.newFop(org.apache.xmlgraphics.util.MimeConstants.MIME_PDF, foUserAgent, bufferedOutputStream);

        // Setup XSLT
        // Specify TransformerFactoryImpl to allow CMEReportXalanDebug to work.
        org.apache.xalan.processor.TransformerFactoryImpl transformerFactory
               = new org.apache.xalan.processor.TransformerFactoryImpl();
        Transformer transformer = transformerFactory.newTransformer(xsltSrc);

        // Set the value of a <param> in the stylesheet
        transformer.setParameter("versionParam", "2.0");

        // Resulting SAX events (the generated FO) must be piped through to FOP
        Result res = new SAXResult( fop.getDefaultHandler() );


        // Start XSLT transformation and FOP processing
        transformer.transform(src, res);

    }
    catch (Exception ex) {

      ex.printStackTrace();
    }

    if (bufferedOutputStream != null) {
      try {
        bufferedOutputStream.close();
      } catch (Exception ex) {
        CMEReportPADPDFTranslate.logger.error(
            "Exception in CreatePDF() -> bufferedOutputStream.close(): " + ex);
      }
    }

        return SPACE_STRING;
  }

    private String getConfigFileURI( String xslFilePath )
    {
        File f = new File( xslFilePath );
        String configFileURI = f.getParent() + "/userconfig.xml";

        return configFileURI;
    }