示例#1
0
        private void Print(String printerAddress, String text, String documentName)
        {
            // A pointer to a value that receives the number of bytes of data that were written to the printer.
            int pcWritten = 0;

            DOCINFO docInfo = new DOCINFO
            {
                pDocName  = documentName,
                pDataType = "RAW"
            };

            OpenPrinter(printerAddress, ref printer, 0);
            StartDocPrinter(printer, 1, ref docInfo);
            StartPagePrinter(printer);

            try
            {
                WritePrinter(printer, text, text.Length, ref pcWritten);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            EndPagePrinter(printer);
            EndDocPrinter(printer);
            ClosePrinter(printer);
        }
示例#2
0
 public static extern long StartDocPrinter(IntPtr hPrinter, int Level, ref DOCINFO pDocInfo);