Esempio n. 1
0
        /// <summary>
        /// Get the Area Tree from Antenna House Formatter
        /// </summary>
        /// <param name="inputStream">XSL:FO tree as ByteArryInputStream</param>
        /// <param name="configFileName">FOP configuration file name: Setting file for Antenna House Formatter rendering</param>
        /// <returns></returns>
        protected XPathDocument GetAreaTrea(ByteArrayInputStream inputStream, string configFileName)
        {
            ByteArrayOutputStream outStream = new ByteArrayOutputStream();

            FOUserAgent            userAgent    = new FOUserAgent(FopFactory.newInstance());
            FopFactoryConfigurator configurator = new FopFactoryConfigurator(userAgent.getFactory());

            if (string.IsNullOrEmpty(configFileName) == false)
            {
                userAgent.getFactory().setUserConfig(configFileName);
            }
            Fop fop = userAgent.getFactory().newFop(MimeConstants.__Fields.MIME_FOP_AREA_TREE, userAgent, outStream);
            TransformerFactory tf          = new TransformerFactoryImpl();
            Transformer        transformer = tf.newTransformer();
            Source             src         = new StreamSource(inputStream);
            Result             res         = new SAXResult(fop.getDefaultHandler());

            transformer.transform(src, res);

            return(outStream.ToXPathDocument());
        }