예제 #1
0
        /// <summary>
        /// Get the Area Tree from Antenna House Formatter
        /// </summary>
        /// <param name="nav">XSL:FO tree</param>
        /// <param name="optionFileName">Option file name: Setting file for Antenna House Formatter rendering</param>
        /// <returns></returns>
        protected XPathDocument GetAreaTrea(XPathNavigator nav, string optionFileName)
        {
            XfoObj processor = null;

            try
            {
                processor = new XfoObj();
                processor.OnFormatPage += new XfoObj.FormatPageEventHandler(OnFormatPage); //returns GCHandle Exception, if loaded in AppDomain
                processor.OnRenderPage += new XfoObj.RenderPageEventHandler(OnRenderPage);
                if (optionFileName != string.Empty)
                {
                    processor.OptionFileURI = optionFileName;
                }
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(nav.OuterXml);
                processor.XmlDomDocument = doc;
                processor.ExitLevel      = 4;
                processor.PrinterName    = "@AreaTree";
                using (MemoryStream outStream = new MemoryStream())
                {
                    processor.Render(doc, outStream, "@AreaTree");
                    outStream.Position = 0;
                    return(new XPathDocument(outStream));
                }
            }
            catch (XfoException e)
            {
                Console.WriteLine(e.Message);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
            return(null);
        }
예제 #2
0
 /// <summary>
 /// Get the Area Tree from Antenna House Formatter
 /// </summary>
 /// <param name="nav">XSL:FO tree</param>
 /// <param name="optionFileName">Option file name: Setting file for Antenna House Formatter rendering</param>
 /// <returns></returns>
 protected XPathDocument GetAreaTrea(XPathNavigator nav, string optionFileName)
 {
     XfoObj processor = null;
     try
     {
         processor = new XfoObj();
         processor.OnFormatPage += new XfoObj.FormatPageEventHandler(OnFormatPage); //returns GCHandle Exception, if loaded in AppDomain
         processor.OnRenderPage += new XfoObj.RenderPageEventHandler(OnRenderPage);
         if (optionFileName != string.Empty)
             processor.OptionFileURI = optionFileName;
         XmlDocument doc = new XmlDocument();
         doc.LoadXml(nav.OuterXml);
         processor.XmlDomDocument = doc;
         processor.ExitLevel = 4;
         processor.PrinterName = "@AreaTree";
         using (MemoryStream outStream = new MemoryStream())
         {
             processor.Render(doc, outStream, "@AreaTree");
             outStream.Position = 0;
             return new XPathDocument(outStream);
         }
     }
     catch (XfoException e)
     {
         Console.WriteLine(e.Message);
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         throw e;
     }
     return null;
 }