Exemplo n.º 1
0
        public Printer(string name)
        {
            _printerSettings = new PrinterSettings();
            if (!string.IsNullOrEmpty(name))
            {
                _printerSettings.PrinterName = name;
            }

            _pageSettings = new PageSettings();
            _pageSettings.PrinterSettings = _printerSettings;
            _pageSettings.Margins         = new Margins(0, 500, 40, 40);

            var options = new EO.WebEngine.BrowserOptions();

            options.UserStyleSheet = File.ReadAllText("essential_printer.css");

            _hiddenForm = new HiddenForm();
            _hiddenForm.Show();
            _hiddenForm.webView.SetOptions(options);
            _hiddenForm.webView.LoadCompleted += LoadCompleted;
        }
Exemplo n.º 2
0
        public Printer(string name)
        {
            IniFile iniFile = new IniFile("EssentialPrinter.ini");

            _printerSettings = new PrinterSettings();
            if (string.IsNullOrEmpty(name))
            {
                _printerSettings.PrinterName = iniFile.GetString("GENERAL", "printer_name", "");
            }
            else
            {
                _printerSettings.PrinterName = name;
            }

            _pageSettings = new PageSettings(_printerSettings);
            Margins m = _pageSettings.Margins;

            _pageSettings.Margins = new Margins(
                iniFile.GetInt("GENERAL", "left_margin", m.Left),
                iniFile.GetInt("GENERAL", "right_margin", m.Right),
                iniFile.GetInt("GENERAL", "top_margin", m.Top),
                iniFile.GetInt("GENERAL", "bottom_margin", m.Bottom));

            var css     = iniFile.GetString("GENERAL", "css", "EssentialPrinter.css");
            var options = new EO.WebEngine.BrowserOptions();

            options.UserStyleSheet = File.ReadAllText(css);

            _hiddenForm = new HiddenForm();
            _hiddenForm.webView.SetOptions(options);
            _hiddenForm.webView.LoadCompleted += LoadCompleted;

            _testMode = iniFile.GetBoolean("GENERAL", "test_mode", false);
            if (_testMode)
            {
                _hiddenForm.Show();
            }
        }