コード例 #1
0
        private void PrintAndCloseMemStream()
        {
            StreamReader sr      = new StreamReader(ms);
            var          printer = new WinPrinter(DirPrintWatcher.Settings.PrinterName, DirPrintWatcher.Settings.WinFont, DirPrintWatcher.Settings.Logo);

            //remove top x lines
            for (int i = 0; i < DirPrintWatcher.Settings.RemoveTopLines && sr.ReadLine() != null; i++)
            {
            }
            ;
            printer.Print(sr);
            sr.Close();
            if (ms != null)
            {
                ms.Close();
            }
            ms = null;
            printer.Cleanup();
        }
コード例 #2
0
        private void WinPrint(string file)
        {
            var          printer = new WinPrinter(DirPrintWatcher.Settings.PrinterName, DirPrintWatcher.Settings.WinFont, DirPrintWatcher.Settings.Logo);
            StreamReader sr      = null;

            try
            {
                sr = new StreamReader(file);
                //remove top x lines
                for (int i = 0; i < DirPrintWatcher.Settings.RemoveTopLines && sr.ReadLine() != null; i++)
                {
                }
                ;
                printer.Print(sr);
            }
            finally
            {
                if (sr != null)
                {
                    sr.Close();
                }
                printer.Cleanup();
            }
        }