Esempio n. 1
0
        /// <summary>
        /// Prints specfied document to fiscal printer.
        /// </summary>
        /// <param name="xml">Input xml.</param>
        /// <param name="output">Output stream, not used.</param>
        /// <remarks>
        /// xml should containt information from printed document and configuration for printer.
        /// </remarks>
        public static void Generate(string xml, Stream output)
        {
            XmlDocument xmlDocument = new XmlDocument();

            xmlDocument.LoadXml(xml);


            XmlNode      configuration = GetConfiguration(xmlDocument);
            PrinterModel printerModel  = GetPrinterModel(configuration);

            using (IFiscalPrinterDriver printer = FiscalPrinterDriverFactory.CreateDriver(printerModel, configuration))
            {
                string documentType = GetDocumentType(xmlDocument);
                switch (documentType)
                {
                case "bill": printer.PrintBill(xmlDocument);
                    break;

                case "dailyReport": printer.PrintDailyReport(xmlDocument);
                    break;

                case "display": printer.Display(xmlDocument);
                    break;

                default:
                    break;
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MakoPrintFiscal"/> class.
        /// </summary>
        /// <param name="printer">The printer model.</param>
        /// <param name="configuration">The printer configuration.</param>
        public MakoPrintFiscal(PrinterModel printer, string configuration)
        {
            XmlDocument xd = new XmlDocument();

            xd.LoadXml(configuration);
            printerDriver = FiscalPrinterDriverFactory.CreateDriver(printer, xd.DocumentElement);
        }