public static bool SendBytesToPrinter(string szPrinterName, IntPtr pBytes, int dwCount)
        {
            int    num      = 0;
            IntPtr hPrinter = new IntPtr(0);

            RawPrinterHelper.DOCINFOA dOCINFOA = new RawPrinterHelper.DOCINFOA();
            bool flag = false;

            dOCINFOA.pDocName  = "LabelBarcode";
            dOCINFOA.pDataType = "RAW";
            bool flag2 = RawPrinterHelper.OpenPrinter(szPrinterName.Normalize(), out hPrinter, IntPtr.Zero);

            if (flag2)
            {
                bool flag3 = RawPrinterHelper.StartDocPrinter(hPrinter, 1, dOCINFOA);
                if (flag3)
                {
                    bool flag4 = RawPrinterHelper.StartPagePrinter(hPrinter);
                    if (flag4)
                    {
                        flag = RawPrinterHelper.WritePrinter(hPrinter, pBytes, dwCount, out num);
                        RawPrinterHelper.EndPagePrinter(hPrinter);
                    }
                    RawPrinterHelper.EndDocPrinter(hPrinter);
                }
                RawPrinterHelper.ClosePrinter(hPrinter);
            }
            bool flag5 = !flag;

            if (flag5)
            {
                Marshal.GetLastWin32Error();
            }
            return(flag);
        }
 public static extern bool StartDocPrinter(IntPtr hPrinter, int level, [MarshalAs(UnmanagedType.LPStruct)][In] RawPrinterHelper.DOCINFOA di);