Exemple #1
0
        /// <summary>
        /// Prints the specified string value to the printer.
        /// </summary>
        /// <param name="value">The value to print.</param>
        public override void Print(string value)
        {
            int    resultCode;
            string aux = "";

            value += "\x1B\x64\x04";   // 4LF
            value += "\x1B" + "i";     // Corte Total

            foreach (char c in value)
            {
                aux += string.Format("{0:X2}", Convert.ToUInt32(c));
            }

            resultCode = niiPrinter.NiiStartDoc(PrinterName, out jobId);
            if (resultCode != 0)
            {
                throw new NiiException(resultCode);
            }

            resultCode = niiPrinter.NiiPrint(PrinterName, aux, aux.Length, out jobId);
            if (resultCode != 0)
            {
                throw new NiiException(resultCode);
            }

            resultCode = niiPrinter.NiiEndDoc(PrinterName);
            if (resultCode != 0)
            {
                throw new NiiException(resultCode);
            }
        }
Exemple #2
0
        /// <summary>
        /// Prints the specified value.
        /// </summary>
        /// <param name="value">The value to print.</param>
        public override void Print(string value)
        {
            int    statusCode;
            string aux = "";

            foreach (char c in value)
            {
                aux += string.Format("{0:X2}", Convert.ToUInt32(c));
            }

            statusCode = niiPrinter.NiiStartDoc(PrinterName, out jobId);
            EnsureSuccessStatusCode(statusCode);

            statusCode = niiPrinter.NiiPrint(PrinterName, aux, aux.Length, out jobId);
            EnsureSuccessStatusCode(statusCode);

            statusCode = niiPrinter.NiiEndDoc(PrinterName);
            EnsureSuccessStatusCode(statusCode);
        }