Exemple #1
0
        public void PrintString(string printerPath, string docName, string sb, ref bool bPrintOK)
        {
            int     pcWritten = 0;
            DOCINFO di        = new DOCINFO();

            di.pDocName  = docName;
            di.pDataType = "RAW";
            System.IntPtr lhPrinter = new System.IntPtr();

            OpenPrinter(printerPath, ref lhPrinter, 0);
            StartDocPrinter(lhPrinter, 1, ref di);
            StartPagePrinter(lhPrinter);
            WritePrinter(lhPrinter, sb, sb.Length, ref pcWritten);
            EndPagePrinter(lhPrinter);
            EndDocPrinter(lhPrinter);
            ClosePrinter(lhPrinter);
            if (pcWritten > 0 && pcWritten == sb.Length)
            {
                bPrintOK = true;
            }
            else
            {
                bPrintOK = false;
            }
        }
Exemple #2
0
 public static extern long StartDocPrinter(IntPtr hPrinter, int Level, ref DOCINFO pDocInfo);